rebase

Showing posts with label rebase. Show all posts
Showing posts with label rebase. Show all posts

Git rebase vs git merge


rebase vs merge

Git rebase

  • When rebasing master branch will take all commits one by one as separate commits.
    • git fetch > git rebase origin/master

The golden rule of rebasing

  • Never use this on public branches

Advantages of rebasing

  • Rebase makes a linear order of commits.
  • Easy to read the history.

Disadvantages of rebase

  • Merge resolve conflicts in a single commit, but rebase, you will have to resolve one by one.

When to use rebase

  • If you need to commit one by one, not as a single commit.
  • When you need to remove a commit
  • When you need to reorder commits

Git merge

  • When we use git merge it will take all commits on the feature branch as one commit to the master branch.

Advantages of merging

  • Simple to use
  • Commit in the source branch are separated from other branches
  • The history will be in the graphical view

Disadvantages of merging

  • Complex to identify commits because of the graphical view.