I have two branches one main and another my feature branch .
I made 3 commit on feature branch at 1pm 2pm and 3pm respectively, now I did the 4th commit on main-dev at 4pm , When I am on feature branch and running git rebase main-dev , on top of 4th commit my 3 commits are there absolutely as expected , but here comes the problem as soon as I am running git push my feature branch is getting diverged and then getting merged into feature again .
French software engineer with 15 year experience on 3D data visualisation and processing. Lots of C++, and switch to Unity recently.
I like when it run fast 😉
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
Ensure your tree is as expected (with gitk or any gui tool), and then
Hello have doubt regarding git rebase .
I have two branches one main and another my feature branch .
I made 3 commit on feature branch at 1pm 2pm and 3pm respectively, now I did the 4th commit on main-dev at 4pm , When I am on feature branch and running git rebase main-dev , on top of 4th commit my 3 commits are there absolutely as expected , but here comes the problem as soon as I am running git push my feature branch is getting diverged and then getting merged into feature again .
Can you help here , why it is happening.
Below screenshot for reference
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:
Ensure your tree is as expected (with gitk or any gui tool), and then
Now you should have the expected behavior.
Hope this help 😊
Note: "git pull --rebase" is a shortcut for "git fetch; git rebase origin/main"
Thanks , adding
--forcewhile pushing after doing rebase helped me in getting expected result.