当我在我当地的回购中并做
git show <commit-SHA>它向我显示了提交及其相关文件的更改。
但是git会在repo中的所有分支上进行搜索,而不仅仅是我当前所在的分支。如何让它显示在提交的本地分支中?
When I am in my local repo and do
git show <commit-SHA>it shows me the commit and its associated file changes.
But git does a search across all branches in the repo, not just the branch I am currently in. How do I get it to display in which of the local branches that commit is located?
最满意答案
如果您想知道哪些分支包含提交,您可以使用
git branch --contains COMMIT_ID这将向您显示跟踪其历史记录返回给定提交的所有分支。
顺便说一下,git没有“搜索所有分支”来查找git show的提交; SHA1总和的要点是Git可以立即转到相关对象,因为它的内容永远不会改变。
If you want to know which branches contain a commit, you can use
git branch --contains COMMIT_IDThis will show you all branches that an trace their history back to the given commit.
As an aside, git doesn't do a "search across all branches" to find a commit for git show; The point of the SHA1 sum is that Git can go immediately to the object in question because its content can never change.
更多推荐
发布评论