我怎麼能知道什麼時候創建了一個git分支?找出什麼時候創建了一個git分支(不是第一次提交到那個分支)
我不想知道什麼時候第一次提交到該分支。 我想知道該分支何時創建。
這是一個腳本複製一個工作示例:
#! /bin/bash
set -x
set -e
mkdir test
cd test
git init
echo "hello" >readme
git add readme
git commit -m "initial import"
date
sleep 5
git checkout -b br1
date # this is the date that I want to find out.
sleep 5
echo "hello_br1" >readme
git commit -a -m "hello_br1"
date
echo "hello_br1_b" >readme
git commit -a -m "hello_br1_b"
git checkout master
echo "hello_master" >readme
git commit -a -m "hello_master"
git branch -a;
git log --all --graph --abbrev-commit --decorate --pretty=format:"%h - %an, %ad : %s" --date=iso
執行此:
./test.sh
++ set -e
++ mkdir test
++ cd test
++ git init
Initialized empty Git repository in /test_git/test2/.git/
++ echo hello
++ git add readme
++ git commit -m 'initial import'
[master (root-commit) 9b95944] initial import
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 readme
++ date
Fri Aug 16 17:51:24 CEST 2013
++ sleep 5
++ git checkout -b br1
Switched to a new branch 'br1'
++ date
Fri Aug 16 17:51:29 CEST 2013
++ sleep 5
++ echo hello_br1
++ git commit -a -m hello_br1
[br1 6c559cd] hello_br1
1 files changed, 1 insertions(+), 1 deletions(-)
++ date
Fri Aug 16 17:51:34 CEST 2013
++ echo hello_br1_b
++ git commit -a -m hello_br1_b
[br1 5f0d8ab] hello_br1_b
1 files changed, 1 insertions(+), 1 deletions(-)
++ git checkout master
Switched to branch 'master'
++ echo hello_master
++ git commit -a -m hello_master
[master 2ed092d] hello_master
1 files changed, 1 insertions(+), 1 deletions(-)
++ git branch -a
br1
* master
++ git log --all --graph --abbrev-commit --decorate '--pretty=format:%h - %an, %ad : %s' --date=iso
* 5f0d8ab - David Portabella, 2013-08-16 17:51:34 +0200 : hello_br1_b
* 6c559cd - David Portabella, 2013-08-16 17:51:34 +0200 : hello_br1
| * 2ed092d - David Portabella, 2013-08-16 17:51:34 +0200 : hello_master
|/
* 9b95944 - David Portabella, 2013-08-16 17:51:24 +0200 : initial import
所以,用git的日誌,或混帳引用日誌,我可以找出最初的日子導入(17:51:24)和第一次提交到分支br1(17:51:34)的日期。
但我需要找出什麼時候創建分支br1(17:51:29)。
該怎麼辦?
(獎金問題:和,它有一個哈希如何知道是誰創建的分支?)
另請參見(1)[尋找兩個分支的共同祖先](http://stackoverflow.com/questions/1549146/find-common-ancestor-of-two-branches),(2)[尋找分支點與Git?](http://stackoverflow.com/questions/1527234/finding-a-branch-point-with-git)和(3)[分支長度:分支在Git中開始?](http: //stackoverflow.com/questions/17581026/branch-length-where-does-a-branch-start-in-git)。 – 2013-08-16 16:51:43
[如何確定何時創建Git分支?](http:// stackoverflow。com/questions/2255416/how-to-determine-when-a-git-branch-was-created) –