Some git snippets

Some useful git snippets

Some git snippets

change branch

# which branch am i on
git branch

# change branch
git checkout <branch-name>

# create new local branch
git branch <new-branch-name>

# checkout a remote branch
git checkout --track origin/<remote branch> 

error - would clobber existing tag

I work across many different machines and rely heavily on the synchronisation of my IDE to maintain the same environment.

Sometimes this can fail.

Once such failure is when I attempt to commit work to git and am presented with an error would clobber existing tag.

> git pull --tags origin <branchName>
 * branch              <branchName> -> FETCH_HEAD
 ! [rejected]          1.0.150    -> 1.0.150  (would clobber existing tag)

I eventually discovered, my tags were not up to date. It was a simple resolution:

# update local tags/sync with remote
git fetch --tags -f 
git pull