1

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

1
  • A branch doesn’t stay associated with its “parent branch” (in quotes, because that’s not a real thing – a branch is just a pointer to a commit). Look at git log --graph --all and run git merge develop. Commented Apr 25, 2017 at 13:16

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

git pull just fetches all the remote changes, but update only the current branch and that too with the changes from remote, not with changes in develop.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.