Git Updating with local changes


Example

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 :

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

Next you can simply use :

git up