rmaddy
rmaddy

Reputation: 318794

Can't see all git commits of branch from master

I have the main master branch checked out in one working folder. I created another branch (let's call it "work"). I checked out the work branch in another working folder. In each working folder I made different changes. I've made commits to both branches. On the work branch I made a few rounds of changes, added a few tags, made my final commit. I pushed all the changes to origin.

Back in the master working copy I pulled the changes. In the master working copy I can do git tag and see the tags I made on the work branch. Note that I have not attempted any merge.

Now here is the problem. If, in my master working copy, I do: git log work, I don't see the last few commits made on the work branch.

Here's the list of commits shown while in the work branch working folder when I do git log work:

commit 6bc8c6e2e25541a204f2d83c3e9a7bbc5e0c43cf (HEAD -> work, tag: rel_6_6_4, origin/work)
commit c722d68bd81efabf5ab87dec433a8b7894ef2779 (tag: rel_6_6_3)
commit e4cedcb225af834c243545cccb3bcf44244ef5f6
commit a132dceff1ac86196d7012b8839e2731e775ea71 (tag: rel_6_6_2)
commit ac3759e8b87825e2c2d3c73c65fff9e033f28dcd
commit 1bedc55d00ac751651b33ca7eb82c4a09e046a8e
commit 428bfd95d9b195ebac61203ef4fd628a5e40a66d
commit f5a2fb8528bbdba76f117910bdc63b4bc68044cb
commit 5c51b13144e01fb190cf9f8840a978a3c51a6b76
commit 94f5dd9998fc977257742f4f29d1ab83fc4323b1
commit 17cb8e66db3bfc3c7fdbe5ebde7e41a1dbbd9614

The last commit shown in this list is where I created the work branch.

If I do git status in the work working folder I see:

On branch work
Your branch is up to date with 'origin/work'

If I run git log work in my master working folder, I see:

commit ac3759e8b87825e2c2d3c73c65fff9e033f28dcd (work)
commit 1bedc55d00ac751651b33ca7eb82c4a09e046a8e
commit 428bfd95d9b195ebac61203ef4fd628a5e40a66d
commit f5a2fb8528bbdba76f117910bdc63b4bc68044cb
commit 5c51b13144e01fb190cf9f8840a978a3c51a6b76
commit 94f5dd9998fc977257742f4f29d1ab83fc4323b1
commit 17cb8e66db3bfc3c7fdbe5ebde7e41a1dbbd9614

As you can see, the most recent 4 commits to the work branch do not appear in this list.

And doing git status in the master working folder shows:

On branch master
Your branch is up to date with 'origin/master'.

How do I get those last 4 commits to the work branch to appear from my working copy of the master branch?

One more clue to the puzzle. If I do git log origin/work from the master working folder, the list of commits looks like:

commit 6bc8c6e2e25541a204f2d83c3e9a7bbc5e0c43cf (tag: rel_6_6_4, origin/work)
commit c722d68bd81efabf5ab87dec433a8b7894ef2779 (tag: rel_6_6_3)
commit e4cedcb225af834c243545cccb3bcf44244ef5f6
commit a132dceff1ac86196d7012b8839e2731e775ea71 (tag: rel_6_6_2)
commit ac3759e8b87825e2c2d3c73c65fff9e033f28dcd (work)
commit 1bedc55d00ac751651b33ca7eb82c4a09e046a8e
commit 428bfd95d9b195ebac61203ef4fd628a5e40a66d
commit f5a2fb8528bbdba76f117910bdc63b4bc68044cb
commit 5c51b13144e01fb190cf9f8840a978a3c51a6b76
commit 94f5dd9998fc977257742f4f29d1ab83fc4323b1
commit 17cb8e66db3bfc3c7fdbe5ebde7e41a1dbbd9614

How do I get (work) to move to that first commit?

If more info is needed, let me know so I can add it to the question.

Upvotes: 2

Views: 1914

Answers (1)

EncryptedWatermelon
EncryptedWatermelon

Reputation: 5598

You're master folder is tracking master, not work. You need to do git log origin/work

Edit: You need to update the work branch inside your master working folder

git checkout work
git merge origin/work
git log work

To go back to master

git checkout master

Shortcut to above command:
git push . origin/work:work

Upvotes: 2

Related Questions