查看git分支创建时间
时间: 2023-06-21 12:13:45 浏览: 84
你可以使用以下命令来查看所有分支的创建时间:
```
git for-each-ref --sort=committerdate refs/heads/ --format='%(refname:short) %(committerdate:relative)'
```
这将输出所有分支的名称和相对创建时间。如果你想按照创建时间的顺序显示分支,则可以使用以下命令:
```
git for-each-ref --sort=committerdate refs/heads/ --format='%(refname:short) %(committerdate:relative)' | sort -k 2
```
这将按照创建时间的顺序显示分支名称和相对时间。
相关问题
如何查看git分支创建历史
可以使用以下命令查看git分支的创建历史:
```
git log --all --remotes --branches --pretty=format:'%Cgreen%h %Cblue%ad %Creset%s %C(yellow)%d%Creset [%an]'
```
其中,`--all` 表示查看所有分支,包括本地和远程分支;`--remotes` 表示只查看远程分支;`--branches` 表示只查看本地分支;`--pretty=format:'%Cgreen%h %Cblue%ad %Creset%s %C(yellow)%d%Creset [%an]'` 表示指定输出格式,包括提交哈希、提交时间、提交信息、分支名称和作者。
执行以上命令后,会输出所有分支的提交历史,包括分支的创建时间和创建人。
查看指定git分支创建事件
可以通过以下命令查看指定git分支的创建事件:
```
git log --reverse --pretty=format:"%h %ad | %s%d [%an]" --date=short <branch-name>
```
其中,`<branch-name>`为要查看创建事件的分支名称。该命令会按照时间顺序列出该分支的所有提交记录,包括创建分支的提交记录。提交记录中包含了提交的哈希值、提交者、提交时间、提交信息等信息。
如果只想查看创建分支的提交记录,可以在命令中加入`--grep`参数,如下所示:
```
git log --reverse --pretty=format:"%h %ad | %s%d [%an]" --date=short --grep="create branch <branch-name>"
```
其中,`<branch-name>`为要查看创建事件的分支名称,`--grep="create branch <branch-name>"`表示只显示提交信息中包含`create branch <branch-name>`的提交记录,即创建该分支的提交记录。