To confirm that all the necessary changes are merged to the develop branch successfully, I am trying to show a merge graph per file like this:
git log --graph --all --oneline --decorate=full develop -- ./path/to/a/file
And if there is a file that forked and not merged like this, I want to ask the owner of the file to merge or delete the branch that contains that file.
* 4151fa9 Commit Message 4
| * 8dc5658 Commit Message 3
* | d579006 Commit Message 2
|/
* 4df043a Commit Message 1
I want to know the name of the branch that forked and not merged (8dc5658
in above), but git log --graph --oneline --decorate
doesn't show the branch name if it takes a file name as its argument.
What I want to get as the result of git log --graph --all --oneline --decorate=full develop -- ./path/to/a/file
is like this:
* 4151fa9 (HEAD -> develop) Commit Message 4
| * 8dc5658 (branch-abandoned) Commit Message 3
* | d579006 Commit Message 2
|/
* 4df043a Commit Message 1
How can I show the branch name in the result of git log --graph --oneline --decorate
when it takes a file name as its argument?
Note that you can show an original branch for a commit with git branch --contains COMMIT
, but it's difficult to identify commits to pass to git branch --contains
from a commit graph (4151fa9
and 8dc5658
in the above) for each file in the repository.
Try adding --simplify-by-decoration
:
# note : if you use '--all', you don't need to add 'develop'
git log --graph --all --oneline --simplify-by-decoration -- path/to/a/file
you will get :
path/to/a/file
If you don't want to see all the possible refs drawn in your graph, you may use --decorate-refs
:
# will only show local branches :
git log ... --decorate-refs=refs/heads
# will only show 'origin/master' and local tags :
git log ... --decorate-refs=refs/remotes/origin/master --decorate-refs=refs/tags