I'm a solo developer and am just getting into using Git with private BitBucket repositories. The one thing I'm not clear on is Merge versus Rebase.
I frequently switch between desktop and laptop and have been using BB to have access to the latest code on either platform. I've been using rebase when I load the latest committed code, because I think it essentially clears out everything on that platform (desktop or laptop) and ensures I have the identical code as committed to BB. Is that correct? When should I use merge to such an action?
rebase and merge are different kind of strategies for bringing your branch uptodate with another branch. rebase changes the history to the point where both branches started diverging. merge on the other hand, does not alter history and might create a new commit to show the merge of two branches.
See also this document on rebase vs merge. Bottomline: use rebase for unpushed changes to create neat history; otherwise use merge.
Update: Linus wrote about this in 2009, see his advice on git rebase and merge. Bottom line: rebase only your own private stuff, with caution. If your commits have been pushed, no more rebasing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With