Friday, July 30, 2010

git update-to

Reading this very useful GIT guide I thought of a possible addition to my GIT aliases set.
On my archlinux box git update-to origin mybranch is currently an alias for git pull --rebase origin mybranch.
It pulls with rebase instead of merge, thus avoiding many unnecessary commits in your history.
NB: It rebases to the branch the command is issued in!

Command to save the alias in your ".gitconfig":
git config --global alias.update-to pull --rebase

Final notes:
When rebasing fails with conflicts is often a good idea to simply merge (with "git pull origin master", for example): no "history-uncluttering" is this much valuable when conflicts-resolving steps in...

No comments:

Post a Comment