Last Updated: February 25, 2016
·
698
· hso

Yet another merge? Replay your commits instead

Sometimes you work on your local copy, commit several changesets and are ready to push... just to find out someone else has pushed already.

To keep your repo's history neat, instead of pulling and merging upstream changes, you can do a rebase:

git pull --rebase origin master

This pulls the latest changes and replays your commits on top of them. No more "Merge branch 'master' of ..." messages polluting your history.