DEV Community

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

Collapse
 
michaelcurrin profile image
Michael Currin

Indeed.

I like to run this on my feature branch to sync up with master

git pull --rebase origin master
Enter fullscreen mode Exit fullscreen mode

And I also build rebasing into my push flow, since I push regularly anyway. As a git alias

git sync
# ie
git pull --rebase && git push
Enter fullscreen mode Exit fullscreen mode

This works great for master too if you do trunk-based development for your own projects.

By the way, in case you if do get a merge commit like this...

git checkout feature
git pull origin master
# commit to merge origin/master into branch
Enter fullscreen mode Exit fullscreen mode

If you then later do a rebase on master, the unwanted commit will actually be removed.

Collapse
 
maulik profile image
Maulik

Thanks Mike, your comment is really helpful