2
幾周前我正在分支,但我不記得分支被稱爲什麼(有很多)。我希望能夠做這樣的事情:顯示git分支與上次提交日期
git branch --print-last-commit
,併爲它的輸出是這樣的:
branch 1 - 2017-02-12
branch 2 - 2016-12-30
等
有沒有辦法做到這一點?
幾周前我正在分支,但我不記得分支被稱爲什麼(有很多)。我希望能夠做這樣的事情:顯示git分支與上次提交日期
git branch --print-last-commit
,併爲它的輸出是這樣的:
branch 1 - 2017-02-12
branch 2 - 2016-12-30
等
有沒有辦法做到這一點?
這將打印BranchName - CommitMessage - 日期爲(2017-06-09)。你可以操縱/編輯這個命令行來適應你的需要。
git for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:short)%(color:reset))'
請注意,它將打印所有本地分支,而不僅僅是當前分支。您可以爲了方便創建別名。
[alias]
branchcommits = !git for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:short)%(color:reset))'
並運行GIT中branchcommits在GIT中bash提示符。
謝謝:-)這太棒了! –