Git - Can you do something with rebase that you can't do with merge? -


every time i've tried rebase, i've been involved in infinite loop of unsolvable conflicts. before resolving x conflict, y conflict appeared, , x conflict again, , on.

the point (apparently) merge, or cherry-pick, provide same functionality expect rebase, don't they? if not, usefulness of rebase?

rebase rewrites history. way more merge or cherry-pick -- advanced tool takes practice (and can dangerous, since rewrites history...be careful git push -f). when rebase used merge, process quite distinctively different.

git fetch origin && git merge origin/master:

  • download changes origin
  • merge changes on top of local branch
  • resolve conflicts , commit

git fetch origin && git rebase origin/master:

  • download changes origin
  • reset local branch common point in history (a commit both local/remote repos share)
  • fast forward origin
  • apply commits on top of new commits 1 one
  • resolve conflicts , commit each local change

the big advantage of rebase in situation you're updating local repo , applying commits on top , there won't "gross" merge commit saying "hey, merged stuff in." downside if have ton of commits modify same files, have resolve conflict on , on again since there no "gross" merge commit.

but again, rebase advanced tool meant rewriting history. can amend previous commit titles, delete commits in past, squash many commits together, etc. read on it!


Comments

Popular posts from this blog

r - how do you merge two data frames the best way? -

How to debug "expected android.widget.TextView but found java.lang.string" in Android? -

php - mySQL problems with this code? -