DEV Community

Discussion on: Fed up with Git conflicts😤?: Rebase regularly and chill!

Collapse
 
yujinyuz profile image
Yujin

I also like this approach.

I'm quite curious btw. What do you usually do when you've already made a Pull Request for this branch and it got reviewed but then they request you to update your branch.

Do you still do a git pull --rebase origin master?

Do you do a git push --force after?

Collapse
 
cyberhck profile image
Nishchal Gautam

me personally, if there's a update thing on PR, I simply run:

gcm && ggpull && git checkout <my-branch> && git rebase master
Enter fullscreen mode Exit fullscreen mode

fix any conflicts, then:

ggpush --force
Enter fullscreen mode Exit fullscreen mode

note: I'm using zsh shell with oh-my-zsh which has aliases:

  • gcm = git checkout master
  • ggpull = git pull origin
  • ggpush = git push origin

And at last I haven't setup on my new machine, but will do soon:
alias rbm = gcm && ggpull && git checkout <current branch> && git rebase master (rebase branch to master)

The there's a interpolation you can use for getting current branch :) I think I'll have to modify above, but should give general idea.

Collapse
 
maulik profile image
Maulik

Thanks @cyberhck for sharing

Collapse
 
maulik profile image
Maulik

Yujin, I currently use Bitbucket. It gives the option to rebase directly on PR diff view
Bitbucket

So it's a bit easy if we don't have any conflict but if there are conflicts then we have to manually rebase with the target branch as @cyberhck mentioned in his comment

Collapse
 
yujinyuz profile image
Yujin

Oh, cool! I didn't know Bitbucket has that feature.

I personally don't like bitbucket but thanks for sharing