git 远程分支按时间排序
I'll be first person to admit I don't do as much git repository maintenance as I should. I rarely delete branches which have been merged, so a git branch
execution shows me a mile-long list of branches that likely aren't relevant. The best way to find branches I've recently used is to use the following command:
我将是第一人称我不做应有的git仓库维护。 我很少删除已合并的git branch
,因此执行git branch
向我显示一英里长的分支列表,这些列表可能与目标无关。 查找我最近使用过的分支的最佳方法是使用以下命令:
git for-each-ref --sort=-committerdate refs/heads/
The command above lists the most recently worked on branches from top to bottom. If you want to see the date of last commit, you can do this:
上面的命令从上到下列出了分支上最近使用的命令。 如果要查看最后一次提交的日期,可以执行以下操作:
git for-each-ref --sort='-committerdate' --format='%(refname)%09%(committerdate)' refs/heads | sed -e 's-refs/heads/--'
I find these commands incredibly helpful when returning to work from a weekend or just jumping from project to project. Hopefully you can use these commands too!
我发现从周末返回工作或从一个项目跳到另一个项目时,这些命令非常有用。 希望您也可以使用这些命令!
git 远程分支按时间排序