What is the difference between an annotated and unannotated tag?
2022-10-27
Question If I want to tag the current commit. I know both of the following command lines work: git tag <tagname> and git tag -a <tagname> -m '<message>' What is the difference between these commands? Answer TL;DR The difference between the commands is that one provides you with a tag message while the other doesn't. An annotated tag has a message that can be displayed with git-show(1), while a tag without annotations is just a named pointer to a commit.…
Cannot push to GitHub - keeps saying need merge
2022-10-26
Question I met some issue when I was trying to push my code to GitHub. Pushing to git@github.com:519ebayproject/519ebayproject.git To git@github.com:519ebayproject/519ebayproject.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'git@github.com:519ebayproject/519ebayproject.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Merge the remote changes (e.g. 'git pull') hint: before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.…
How do you stop tracking a remote branch in Git?
2022-10-26
Question How do you stop tracking a remote branch in Git? I am asking to stop tracking because in my concrete case, I want to delete the local branch, but not the remote one. Deleting the local one and pushing the deletion to remote will delete the remote branch as well: How do I delete a Git branch both locally and in GitHub? Can I just do git branch -d the_branch, and it won't get propagated when I later git push?…
Unstaged changes left after git reset --hard
2022-10-26
Question After git reset --hard, git status gives me files within the Changes not staged for commit: section. I've also tried git reset ., git checkout -- . and git checkout-index -f -a, to no avail. So, how can I get rid of those unstaged changes? This seems to hit only Visual Studio project files. Weird. See this paste: http://pastebin.com/eFZwPn9Z. What is special with those files, is that in .gitattributes I have:…
Git error when trying to push -- pre-receive hook declined
2022-10-25
Question When I try and push a change I've commited, I get the following error ... git.exe push -v --progress "origin" iteration1:iteration1 remote: ********************************************************************* To ssh://git@mycogit/cit_pplus.git ! [remote rejected] iteration1 -> iteration1 (pre-receive hook declined) error: failed to push some refs to ‘ssh://git@mycogit/cit_pplus.git’ What's going on? Answer You should ask whoever maintains the repo at git@mycogit/cit_pplus.git. Your commits were rejected by the pre-receive hook of that repo (that's a user-configurable script that is intended to analyze incoming commits and decide if they are good enough to be accepted into the repo).…
How do I remove a directory from a Git repository?
2022-10-25
Question How can I delete a single directory containing files from a Git repository? Answer Remove directory from Git and local Checkout 'master' with both directories: git rm -r one-of-the-directories // This deletes from filesystem git commit . -m "Remove duplicated directory" git push origin <your-git-branch> (typically 'master', but not always) Remove directory from Git but NOT local To remove this directory from Git, but not delete it entirely from the filesystem (local):…
How to keep a branch synchronized/updated with master?
2022-10-25
Question At the moment git is doing my head in, I cannot come up with the best solution for the following. There are two branches, one called master and one called mobiledevicesupport. I want to keep mobiledevicesupport as a continuous branch that will be merged/synced with the master branch whenever mobiledevicesupport is stable. This would merge changes from mobiledevicesupport into master but also bring all the changes from master into mobiledevicesupport so that branch can continue to be worked on and the features improved or amended.…