Stop your inconsiderate "git pull"

July 29, 2014

A recent merge request:

Too much branch merging

Why is it a problem ?

Because when you navigate in your commits log, this is a lot of noise. Of course, you can filter the logs but when you go through your commits log, it's rarely for the beauty of it. It's because you need to fix a bug, or assert if a specific fix made it into the current branch.

Why does it behave like that ?

  • you want to stay up-to-date with "origin/develop" and you pull regularly AND
  • your local "develop" has a change not in "origin/develop"
So everytime you pull (aka fetch + merge), git has to create a commit to acknowledge the merge. If you had, in your branch "develop" the same work as in "origin/develop", you will have the so pleasant "fast forward" message :)

How to prevent that

  1. git fetch --all
  2. git co -b devtodo origin/develop
  3. [commit brilliant programming here]
  4. git fetch --all
  5. git merge origin/develop
  6. git push origin develop
  7. [create a clear merge request or send a patch]

And then ?

And then, after your merge request has been accepted, the next time you pull "origin/develop" in your local "develop", the work you did in "devtodo" will enter your develop with via a fast forward.