Created
January 8, 2010 08:23
-
-
Save hiratara/271916 to your computer and use it in GitHub Desktop.
SHA1 ID of commits and trees. (in Japanese)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 内容は同じだけど履歴は違うけどブランチ master と two-phases を作る | |
% git init | |
Initialized empty Git repository in /private/tmp/myrepo/.git/ | |
% touch ab.txt | |
% git add ab.txt; git commit -m 'a empty file' | |
[master (root-commit) 7d9d5ea] a empty file | |
0 files changed, 0 insertions(+), 0 deletions(-) | |
create mode 100644 ab.txt | |
% echo 'A\nB' > ab.txt | |
% git commit -am 'A and B' | |
[master c7091de] A and B | |
1 files changed, 2 insertions(+), 0 deletions(-) | |
% git checkout -b two-phases HEAD~ | |
% echo 'A' > ab.txt | |
% git commit -am 'A added' | |
[two-phases 4cf3183] A added | |
1 files changed, 1 insertions(+), 0 deletions(-) | |
% echo 'B' >> ab.txt | |
% git commit -am 'B added' | |
[two-phases 246f617] B added | |
1 files changed, 1 insertions(+), 0 deletions(-) | |
# ツリーは一緒 | |
% git cat-file -p master | |
tree b4077185390b0ff9495a6db2122e9b478c50af08 | |
parent 7d9d5ea99dcdf9e9c270dab09affc6d0c4705e46 | |
author hiratara <hiratara@cpan.org> 1262937776 +0900 | |
committer hiratara <hiratara@cpan.org> 1262937776 +0900 | |
A and B | |
% git cat-file -p two-phases | |
tree b4077185390b0ff9495a6db2122e9b478c50af08 | |
parent 4cf31836d3c5069bd5f12c68468369b9dbafaa29 | |
author hiratara <hiratara@cpan.org> 1262937874 +0900 | |
committer hiratara <hiratara@cpan.org> 1262937874 +0900 | |
B added | |
# コミットのIDは別 | |
% git rev-parse master | |
c7091de25d27cf53570cd850a72fde5e087aa122 | |
% git rev-parse two-phases | |
246f6173aec6c82e9fbd2da14f8e9391aa179d15 | |
# show-branch の結果 | |
% git show-branch master two-phases | |
! [master] A and B | |
* [two-phases] B added | |
-- | |
* [two-phases] B added | |
* [two-phases^] A added | |
+ [master] A and B | |
+* [two-phases~2] a empty file | |
# 全く同じ履歴をshow-branchするとこう | |
% git show-branch master c7091de25d27 | |
! [master] A and B | |
! [c7091de25d27] A and B | |
-- | |
++ [master] A and B | |
% git show-branch two-phases 246f6173aec | |
* [two-phases] B added | |
! [246f6173aec] B added | |
-- | |
*+ [two-phases] B added | |
# 念のため、master と two-phases に another ブランチをマージして show_branch する | |
% git checkout -b another HEAD~2 | |
Switched to a new branch 'another' | |
% echo 'C' > c.txt | |
% git add c.txt; git commit -m "C added" | |
[another 8fafada] C added | |
1 files changed, 1 insertions(+), 0 deletions(-) | |
create mode 100644 c.txt | |
% git checkout master | |
Switched to branch 'master' | |
% git merge another | |
Merge made by recursive. | |
c.txt | 1 + | |
1 files changed, 1 insertions(+), 0 deletions(-) | |
create mode 100644 c.txt | |
% git checkout two-phases | |
Switched to branch 'two-phases' | |
% git merge another | |
Merge made by recursive. | |
c.txt | 1 + | |
1 files changed, 1 insertions(+), 0 deletions(-) | |
create mode 100644 c.txt | |
# show-barnch すると履歴は違いそう | |
% git show-branch master two-phases | |
! [master] Merge branch 'another' | |
* [two-phases] Merge branch 'another' into two-phases | |
-- | |
- [two-phases] Merge branch 'another' into two-phases | |
* [two-phases^] B added | |
* [two-phases~2] A added | |
- [master] Merge branch 'another' | |
+* [two-phases^2] C added | |
# でも、ツリーのSHA1は同じ | |
% git cat-file -p master | |
tree 0ef0528a594b679def8ed8910a66254fa7351adc | |
parent c7091de25d27cf53570cd850a72fde5e087aa122 | |
parent 8fafadace4f525d2c20d9b29daecb34b3867bf05 | |
author hiratara <hiratara@cpan.org> 1262938703 +0900 | |
committer hiratara <hiratara@cpan.org> 1262938703 +0900 | |
Merge branch 'another' | |
% git cat-file -p two-phases | |
tree 0ef0528a594b679def8ed8910a66254fa7351adc | |
parent 246f6173aec6c82e9fbd2da14f8e9391aa179d15 | |
parent 8fafadace4f525d2c20d9b29daecb34b3867bf05 | |
author hiratara <hiratara@cpan.org> 1262938741 +0900 | |
committer hiratara <hiratara@cpan.org> 1262938741 +0900 | |
Merge branch 'another' into two-phases |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment