OCT
19
2012

Updating a git checkout - finally as easy as with svn

git: very powerful, not easy to use for simple tasks.
Especially when coming from svn, where updating a local checkout was simply "svn up", and with git it's "git pull --rebase, and if that fails, stash, pull --rebase, stash pop".

Finally, all this can be automated, so that one can simply keep the good old habits from svn and type "git up"!

Here's the recipe. In your ~/.gitconfig, write
[alias]
up = !gitup

Then download the script http://www.davidfaure.fr/scripts/gitup and put it in your $PATH.
Done!
(Should have done that years ago...)

Before the git purists start screaming, yes, I know, one should not do that (rebasing when pulling) if sharing your local branch with other people. But let's face it, you usually don't do that :-)

Comments

Thanks for your post, this is valuable script :)

My current alias for 'git up' is 'pull --rebase --stat', I'm curious if I can integrate this example in a single alias too.


By vdboor at Sat, 10/20/2012 - 14:53

You can put this into ~/.gitconfig, for more interesting output from git pull --rebase:

[rebase]
stat = true


By dfaure at Sat, 10/20/2012 - 19:38