Git Updating with local changes


When local changes are present, the git pull command aborts reporting :

error: Your local changes to the following files would be overwritten by merge

In order to update (like svn update did with subversion), you can run :

git stash
git pull --rebase 
git stash pop

A convenient way could be to define an alias using :

git config --global alias.up '!git stash && git pull --rebase && git stash pop'
git config --global alias.up 'pull --rebase --autostash'

Next you can simply use :

git up