DEV Community

Discussion on: Tiny Tips : git pull --rebase

Collapse
 
tandrieu profile image
Thibaut Andrieu

Hi,

That's unexpected, indeed. Do you use command line or a GUI FrontEnd like SourceTree or GitKraken ? GUI Frontend tends to do some extra stuff behind the scene.

You can try to do it fully by hand:

git fetch  # retrieve server modifications
git checkout feature/cart-page  # ensure you are in your feature branch
git rebase origin/main # rebase current branch onto origin/main branch
Enter fullscreen mode Exit fullscreen mode

Ensure your tree is as expected (with gitk or any gui tool), and then

git push origin feature/cart-page:feature/cart-page
Enter fullscreen mode Exit fullscreen mode

Now you should have the expected behavior.

Hope this help 😊

Note: "git pull --rebase" is a shortcut for "git fetch; git rebase origin/main"

Collapse
 
zeffk profile image
Huzaif Qazi

Thanks , adding --force while pushing after doing rebase helped me in getting expected result.