

git rebase! The action of rebasing is conceptually simple: you’re playing a set of changes on top of another branch. I like Travis Swicegood’s metaphor the best: rebase is like a meat cleaver. Given the right amount of skill, you can slice and dice your commits the way you want. Here’s an example of a feature branch we just had for Hoptoad:

$ git checkout master
$ git merge lighthouse_config

Our merge commit specifically denotes when we brought our work into master. This is a perfectly acceptable way of bringing in our changes, but now we have these two paths of history when we don’t necessarily need them. Especially for long lived feature branches, this can start to become a mess in your history if you have multiple features being developed in parallel.
Another issue is when you want to bring in the latest upstream changes to your feature branch: you’ll get a lot of little merge commits. Rebasing blows away those tiny merge commits that we used for when we wanted to sync up with the master branch. So, this means that all you’re left with is the clean history of what happened. The commits have been moved to on TOP of the master branch after a git rebase master:
$ git checkout lighthouse_config
$ git rebase master

$ git checkout lighthouse_config
$ git rebase -i master

git pull --rebase when pulling down your latest changes, or just use git fetch and git rebase as you see fit. Just remember the golden rule of rebasing and you’ll be fine: NEVER rebase existing, pushed commits!
Shoulda