Reputation: 15
I have master
branch. I created branch A
based on master
.
My teammate created branch B
based on master
too and he merged it into master
.
I need a new data from branch B
and I try to "rebase" branch A
onto master
, but git loses some commits and generates the wrong file when rebasing. No simultaneous changes have occurred in the same file (A has no conflicts with B). What could be the problem? How to update a branch without creating a mess in Git?
Upvotes: 0
Views: 231
Reputation: 3057
As you say branchB
is merged into master
, then make sure to do the following:
git checkout master
- that will switch local branch to master
git pull origing
- that will pull latest changes from remote branch to local
git checkout branchA
- switch to local branchA
git rebase master
- rebase on master
But be aware, that branchA
will still show you only local commits in history. It will not show commits from branchB
- although, if rebase is successful, then it will contain all the changes from merged branchB
. And this is because how rebase works - it takes every commit from branchA
, and replays them on master
. Kinda if you would have first merged branchB
to master
, and then created branchA
, and did commits.
Upvotes: 1