Updating local Git repository to most recent version

This entry was posted by on Tuesday, 19 April, 2011 at

So I use some software from a Git repository. The idea is simple, when the developers update it I simply have to update the local repository to the recent HEAD in the master branch and I have the up-to-date stuff to link against.

But how to do this?

$ git pull
Should do the trick when executed in the directory where the .git is located (find this with ls -lAh to show hidden files).

You may get an error like:

5764cf9..5d8cc2a master -> origin/master
Updating 5764cf9..5d8cc2a
error: Your local changes to '.oppbuildspec' would be overwritten by merge. Aborting.
Please, commit your changes or stash them before you can merge.

This can be easily fixed:
$ git stash save "updating to head from repo"
And now we can proceed with the git pull command.

Thanks to http://ic3man5.wordpress.com/2010/04/07/git-update-working-copy-with-remote/

Leave a Reply