Reputation: 2066
I've created the branchA from branch develop
# git checkout -b branchA
# git push origin -u branchA
modify some files
# git add *
# git commit -m "modification in branchA"
# git push
# git checkout develop
# git merge branchA
# git push
then I've created another branch
# git checkout -b branchB
# git push origin -u branchB
modify some files
# git add *
# git commit -m "modification in branchB"
# git push
# git checkout develop
# git merge branchB
# git push
Then again working in branchA
# git checkout branchA
I modified 1 JSP (home.jsp)
# git add *
# git commit -m "modification in branchA"
# git push
# git checkout develop
# git merge branchA
# git push
Then I come back to branchB
# git checkout branchB
# git pull
But I don't have the changes I made in home.jsp
Upvotes: 1
Views: 79
Reputation: 16763
First of all, use git push
only on tracking branches, if you haven't set your branch as tracking one, it's always safer to use git push origin branch_name
. You can create a new tracking branch easily though by
git branch --track branch-name origin/branch-name
git branch --set-upstream-to <remote-branch> # for existing branches
Now, if I'm getting it right, you made the change in branchA in second last step and merged it into develop, but you haven't updated the branchB with changes in develop yet. That's why you see no changes in branchB from branchA. Just because you forked out branchB from develop, doesn't mean it would always stay updated with changes in develop.
git checkout branchB
git merge develop
Now the changes you made should be reflected in branchB
Upvotes: 1