Member-only story

Stop using Git Rebase immediately

Beck Moulton
2 min readJun 3, 2024

--

In the programming world, version control systems like Git are our trusted partners, ensuring that our code remains clean and that collaborative work runs smoothly.

In the existing debate between git rebaseand git merge, we will explore why choosing the latter (git merge) can save developers a lot of trouble, especially when multiple people are working on the same piece of code.

Suppose you are developing a new feature branch and you want to pull the latest changes from the main development branch. The goal is to smoothly merge these updates into your feature branch while dealing with any conflicts that may arise.

Dangerous path: git rebase

Step 1: Update local development branch

git checkout develop

git pull origin develop

Step 2: Submit a re-based feature branch from the latest development branch

git checkout feature/my_new_shiny_feature

git rebase develop

Step 3: Resolve merge conflicts

Resolve merge conflicts from development branch to feature branch.

Step 4: Push changes to remote (risky)

git push origin feature/my_new_shiny_feature — force

By using git rebase, you are actually rewriting your commit history to make it look neater. However, there is a trap here - when you push the redesigned feature…

--

--

Beck Moulton
Beck Moulton

Written by Beck Moulton

Focus on the back-end field, do actual combat technology sharing Buy me a Coffee if You Appreciate My Hard Work https://www.buymeacoffee.com/BeckMoulton

No responses yet