A nice handbook for “unfucking” git commits with command line when things get ugly by Melanie G. A. PATRICK from Trivago
One I’d like to add myself, experimented today on my skin, is about fetching.
Let’s say you created some new tags on BitBucket/Stash/YourGitRepositoryOfChoice and now you want to checkout locally one of these new tags. You might assume that firing a “git fetch” will update everything, you proceed to checkout the tag but your command fails.
Turns out that if you want the tags to be updated, you’ll have to ask for them explicitly :
git fetch --tags
Before version 2 of git, the
fetch command alone would update branches heads and with
--tags option would update only tags, after version 2 when the option is included it will update tags and branches heads, aligning local workspace with remote repository.