Reputation: 19969
I've been using Git for a while, but more casually just merging in topic branches and pull requests. I'm not understanding what git log --oneline --graph
is telling me here. The two branches shown are master and my6.
Specifically, I don't understand the 4e4e1fd jt2 on master
commit which seems like it's on the wrong branch. Is the star on the left branch showing what branch it's in?
To get here, I:
The graph is obviously correct but it seems like 4e4e1fd jt2 on master
is on the wrong branch, appearing on the my6 branch rather than master. What am I not understanding?
Upvotes: 0
Views: 261
Reputation: 106410
It's on the right branch. Here's how we know:
- checked out master
- made edits and commited as 'jt2 on master'
You checked out your master branch, then made the changes on it directly. You then went back to your other branch and made other changes. This is why you don't see the change on my6
; there's nothing yet linking their ancestry chain together.
When you merge my6
into master
, both commits appear as they should, and there really shouldn't be any three-way merges unless it was the same file.
If you want to audit this, you can check git reflog
, which will give you a synopsis of every action you've taken in Git so far, up to about 3 months. You'll be able to see which branch you were on when you commited and merged.
If you want to improve the layout you get from the terminal, then you can use git log --graph --oneline --decorate
, which will give you more context into the branches and what is on them.
Upvotes: 1