Git merge vs rebase

There is no hard and fast rule. But i am putting out when to use what based on my experience.

Merge if

  • you are in a big team working on a feature branch and you want to rebased from master. If you dont have all the commits you are in trouble.
  • When you find rebasing is becoming painful for no reason. like for every rebase step you need to fix the same lines of code again and again.
  • Not worried about one more additional commit and order of commits as they are going to be mixed up.

Rebase if

  • you dont want to change the commit history/log.
  • You want the commit history looks clean. As new work will be on top of everything.
  • when you have less code changes or you know how to deal with conflicts (more patience required practice meditation).
  • you branched off of feature branch to your own branch. You can do what ever you want as its your world.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.