I want to browse git history (in bash terminal) of only specific git branches. This scenario is pretty frequent use case, because people do want to compare their "feature" branch with the "master" branch.
Naively, I tried:
git log --oneline --decorate --graph --branches=feature/my_cool_feature
But even in this case I see all the other branches.
Can anyone help with the git command (in bash terminal) to show the graph of git history for only the specified branches?
Graph all git branchesDevelopers can see all branches in the graph with the –all switch. Also, in most situations, the –decorate switch will provide all the supplemental information in a formatted and nicely color-coded way.
To compare any two commits in your branch, use the Ctrl key to select the two commits that you want to compare. Then right-click one of them and select Compare Commits.
Git offers a feature referred to as a worktree, and what it does is allow you to have multiple branches running at the same time. It does this by creating a new directory for you with a copy of your git repository that is synced between the two directories where they are stored.
The command
git show-branch feature master
will show commits that only exist in either master or feature but not both.
I think this is the command you're looking for.
git log --oneline --graph --decorate somebranch otherbranch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With