|
|
|
|
|
by cocoflunchy
4869 days ago
|
|
This is a great tool, thanks so much ! I have trouble understanding the rebase workflow:
What is the difference between these two sequences? git checkout -b bugFix
git commit -m "fix"
git checkout master
git commit -m "master stuff"
git rebase bugFix
git checkout bugFix
git rebase master
and git checkout -b bugFix
git commit -m "fix"
git checkout master
git commit -m "master stuff"
git checkout bugFix
git rebase master
git checkout master
git rebase bugFix
Is it just the order of the commits in the final tree that will be different? Or I am missing something else?Instinctively I would tend to do the first one, but that was not what lesson 4 expected... |
|
If you rebase, then anyone who has the old commits in their repo will have to use git reset --hard to switch to the new branch. In other words, rebase inconveniences all other users of a branch. So you can use it freely on branches that only you work on, but you should be reluctant to use it on branches used by other people -- especially popular branches like "master".
If you use your first workflow, the app clearly shows that you discard the commit C3 ("master stuff") and replace it with a different commit C3'. This requires everyone on master to reset.
If you use your second workflow, the commit that you're discarding is C2 ("fix") instead. This means that only people who checked out C2 on bugFix need to reset.