3 ms·
> Unless you have some other strategy that does not include rebasing or merging upstream changes, there's no advantage to not pulling. Of course there is: afte
by masklinn 3y ago
> Unless you have some other strategy that does not include rebasing or merging upstream changes, there's no advantage to not pulling.
Of course there is: after fetching you can see if there are differences between upstream and local, you can inspect those difference, and you can decide how to reconcile the two.
“Pull” is a big hammer which unconditionally performs an integration operation, and the default integration is one you almost never want too.
There‘a no advantage to pulling IME, in the best car scenario it’s just an alias for “git fetch && git merge”, if that’s what you want you can just do that and create your own alias.
- lelanthran 3y ago> Of course there is: after fetching you can see if there are differences between upstream and local, you can inspect those difference, and you can decide how to reconcile the two. [FWIW, it seems you know more about this than I do, so don't think that I am purposefully trying to be annoying. I'm not, I hope :-)] I agree that you can see the differences, but I'm asking how helpful is this. For me, anyway (not an advanced git user) seeing the differences between master and my feature branch before doing the rebase makes no difference - I'm still going to do the rebase no matter what I see in the feature branch. It is going to be rare for me to be able to see, of the 10 merges to master, if an of them are going to break the code in a way that I cannot continue (in which case I won't rebase). The longer I put off rebasing, the harder it is going to be to do it, so I am highly motivated to rebase on whatever master has, even if it just got broken, because it will be more painful to rebase later.
- nordsieck 3y agoOne big benefit to fetch+rebase over pull is that you can create a backup branch before you rebase so that if you mess up the rebase too much, you can undo easily. Another situation I've run into is that sometimes I've made a small change that's stacked on top of a lot of other branches. And if those other branches get squashed and merged, regular rebasing can be really annoying - it is often easier to cherry-pick (I use rebase --onto, but same idea) your changes onto main/master instead.
- masklinn 3y agoIf you mess up a rebase you can always rebase -—abort (/ use the reflog) to restore the pre-rebase state.
- nordsieck 3y ago> If you mess up a rebase you can always rebase -—abort (/ use the reflog) to restore the pre-rebase state. That is true. But a few times, I've finished rebasing and regretted how I handled conflicts. And once the rebase is complete, you can't abort any more. And I haven't put in the time to learn how to use reflog. Maybe this is my sign to do so.
- Jochim 3y agowhy create a backup branch instead of just pointing the rebased branch back at the original commit?
- nordsieck 3y ago> why create a backup branch instead of just pointing the rebased branch back at the original commit? I mean, isn't that what a backup branch is? How are you going to get the hash of the original commit if you don't create a branch? I suppose you could use git log or something to print the hash to the terminal, but that's just way more fragile than using git to keep track.
- 3y ago