[過去ログ]
Git 18 (1002レス)
Git 18 http://mevius.5ch.net/test/read.cgi/tech/1650651945/
上
下
前
次
1-
新
通常表示
512バイト分割
レス栞
このスレッドは過去ログ倉庫に格納されています。
次スレ検索
歴削→次スレ
栞削→次スレ
過去ログメニュー
911: デフォルトの名無しさん (ワッチョイ 617b-8+ss) [sage] 2022/11/05(土) 21:51:56.84 ID:646uiMLL0 >>909 結果 $ git show-branch ! [develop] impl5 * [master] impl5 -- +* [develop] impl5 $ git branch develop * master http://mevius.5ch.net/test/read.cgi/tech/1650651945/911
912: デフォルトの名無しさん (ワッチョイ 617b-8+ss) [sage] 2022/11/05(土) 21:52:24.93 ID:646uiMLL0 >>909 $ git diff HEAD~1 diff --git a/test.txt b/test.txt index 3585d98..bbddc42 100644 --- a/test.txt +++ b/test.txt @@ -4,3 +4,4 @@ impl1 impl2 impl3 impl4 +impl5 $ git diff @{1} diff --git a/test.txt b/test.txt index e79c5e8..bbddc42 100644 --- a/test.txt +++ b/test.txt @@ -1 +1,7 @@ initial +impl0 +impl1 +impl2 +impl3 +impl4 +impl5 http://mevius.5ch.net/test/read.cgi/tech/1650651945/912
913: デフォルトの名無しさん (ワッチョイ 617b-8+ss) [sage] 2022/11/05(土) 21:53:21.88 ID:646uiMLL0 >>909 再現コード #!/bin/bash -x # git init echo 'initial' > test.txt git add test.txt git commit -m 'initial' git branch develop for (( i=0 ; i<6 ; i++ )); do git branch feature$i git switch feature$i echo "impl"$i >> test.txt git add test.txt git commit -m "impl"$i git switch develop git merge feature$i git branch -d feature$i done git switch master git merge develop http://mevius.5ch.net/test/read.cgi/tech/1650651945/913
914: デフォルトの名無しさん (ワッチョイ 617b-8+ss) [sage] 2022/11/05(土) 22:01:15.70 ID:646uiMLL0 >>909 ちなreflog $ git reflog 1a804d9 (HEAD -> master, develop) HEAD@{0}: merge develop: Fast-forward b0325fc HEAD@{1}: checkout: moving from develop to master 1a804d9 (HEAD -> master, develop) HEAD@{2}: merge feature5: Fast-forward ba4e962 HEAD@{3}: checkout: moving from feature5 to develop 1a804d9 (HEAD -> master, develop) HEAD@{4}: commit: impl5 ba4e962 HEAD@{5}: checkout: moving from develop to feature5 ba4e962 HEAD@{6}: merge feature4: Fast-forward a32e11d HEAD@{7}: checkout: moving from feature4 to develop ba4e962 HEAD@{8}: commit: impl4 a32e11d HEAD@{9}: checkout: moving from develop to feature4 a32e11d HEAD@{10}: merge feature3: Fast-forward 8d9924f HEAD@{11}: checkout: moving from feature3 to develop a32e11d HEAD@{12}: commit: impl3 8d9924f HEAD@{13}: checkout: moving from develop to feature3 8d9924f HEAD@{14}: merge feature2: Fast-forward 0f78740 HEAD@{15}: checkout: moving from feature2 to develop 8d9924f HEAD@{16}: commit: impl2 0f78740 HEAD@{17}: checkout: moving from develop to feature2 0f78740 HEAD@{18}: merge feature1: Fast-forward 47792a3 HEAD@{19}: checkout: moving from feature1 to develop 0f78740 HEAD@{20}: commit: impl1 47792a3 HEAD@{21}: checkout: moving from develop to feature1 47792a3 HEAD@{22}: merge feature0: Fast-forward b0325fc HEAD@{23}: checkout: moving from feature0 to develop 47792a3 HEAD@{24}: commit: impl0 b0325fc HEAD@{25}: checkout: moving from master to feature0 b0325fc HEAD@{26}: commit (initial): initial http://mevius.5ch.net/test/read.cgi/tech/1650651945/914
915: デフォルトの名無しさん (ワッチョイ 617b-8+ss) [sage] 2022/11/05(土) 22:02:09.13 ID:646uiMLL0 >>909 ついでに一応、終了時のtest.txt $ cat test.txt initial impl0 impl1 impl2 impl3 impl4 impl5 http://mevius.5ch.net/test/read.cgi/tech/1650651945/915
916: デフォルトの名無しさん (ワッチョイ 09e4-chQ5) [sage] 2022/11/05(土) 22:05:21.84 ID:zDjINlW+0 >>911-915 これ全部FFマージやってるから結果的にdevelopブランチとmasterブランチが同じものになるぞ http://mevius.5ch.net/test/read.cgi/tech/1650651945/916
917: デフォルトの名無しさん (ワッチョイ 09e4-chQ5) [sage] 2022/11/05(土) 22:09:56.21 ID:zDjINlW+0 mergeを全部merge --no-ffにするとマージした構造がわかるようになるし、最後にdevelopとmasterが別のものになる どっちのマージにするかは現場の運用しだい http://mevius.5ch.net/test/read.cgi/tech/1650651945/917
918: デフォルトの名無しさん (ワッチョイ 09e4-chQ5) [sage] 2022/11/05(土) 22:10:47.10 ID:zDjINlW+0 git log --graph --branches --oneline とかするとわかりやすい http://mevius.5ch.net/test/read.cgi/tech/1650651945/918
919: デフォルトの名無しさん (ワッチョイ 617b-8+ss) [sage] 2022/11/05(土) 22:11:46.51 ID:646uiMLL0 >>916 ああ、それがrebaseしないと履歴が無くなるとかいう話か? 実はそれはまだ確認中だが、とりあえず本件についてはこれでいいし、 俺的には多分こうなる。(基本的にmasterはdevelopの後を追うだけ) けしからんか? それはさておき、本件、HEAD~1 と @{1} が違うものだという経路情報は、 どこにあるのか分かれば教えてくれ。 http://mevius.5ch.net/test/read.cgi/tech/1650651945/919
920: デフォルトの名無しさん (ワッチョイ 09e4-chQ5) [sage] 2022/11/05(土) 22:22:33.37 ID:zDjINlW+0 HEAD~1と@{1}は全然関係無いよ? HEAD~1は今のHEADの一番目の親のhash 親が複数いるときにはHEAD^1とかHEAD^2とかで指定する @{1}はひとつ前の操作によってHEADになったhashだから、どういう操作したかで変わり、リポジトリの構造とは関係無い http://mevius.5ch.net/test/read.cgi/tech/1650651945/920
921: デフォルトの名無しさん (ワッチョイ 09e4-chQ5) [sage] 2022/11/05(土) 22:30:34.81 ID:zDjINlW+0 >>914 で説明すると、 @{0}は最後のコミットで、FFマージした結果masterとdevelopがこのhash=1a804d9になった @{1}はgit commit -m 'initial'の結果できた最初のコミット(最後のマージ操作の前のmaster)で、最後にこれにdevelopをマージするためcheckoutしたらこれになってる http://mevius.5ch.net/test/read.cgi/tech/1650651945/921
922: デフォルトの名無しさん (ワッチョイ 617b-8+ss) [sage] 2022/11/05(土) 22:35:17.82 ID:646uiMLL0 >>920 > @{1}はひとつ前の操作によってHEADになったhashだから、どういう操作したかで変わり、リポジトリの構造とは関係無い だから、それは「そのbranchの」一つ前の操作なんだよ。 結果、diffは、masterブランチでは>>912で、HEAD~1 != @{1} だが、 developブランチでは、以下になって、 HEAD~1 == @{1} なんだよ。 $ git diff HEAD~1 diff --git a/test.txt b/test.txt index 3585d98..bbddc42 100644 --- a/test.txt +++ b/test.txt @@ -4,3 +4,4 @@ impl1 impl2 impl3 impl4 +impl5 $ git diff @{1} diff --git a/test.txt b/test.txt index 3585d98..bbddc42 100644 --- a/test.txt +++ b/test.txt @@ -4,3 +4,4 @@ impl1 impl2 impl3 impl4 +impl5 だからmasterブランチをdevelopにmergeしかしない運用をした場合、 masterブランチは @{n} でn回前のリリースが検索出来、存在価値が出てくる、という見立てだが、間違ってるか? (@はcommit履歴だと思ってるが、まさか操作履歴か?なら確かに意味無いし、先頭情報しか要らないし、reflogしかなくても納得だが) http://mevius.5ch.net/test/read.cgi/tech/1650651945/922
923: デフォルトの名無しさん (ワッチョイ 09e4-chQ5) [sage] 2022/11/05(土) 22:40:04.85 ID:zDjINlW+0 最終的にお前のリポジトリは git merge develop でこうなっているはずだ $ git log --graph --branches --oneline * 1a804d9 impl5 (HEAD -> master, develop) * xxxxxxx impl4 * xxxxxxx impl3 * xxxxxxx impl2 * xxxxxxx impl1 * xxxxxxx impl0 * b0325fc initial 最後のひとつ前の git switch master をやったときにはこうなっていたはず * 1a804d9 impl5 (develop) * xxxxxxx impl4 * xxxxxxx impl3 * xxxxxxx impl2 * xxxxxxx impl1 * xxxxxxx impl0 * b0325fc initial (HEAD -> master) だから HEAD@{0} = 1a804d9 で、HEAD@{1} = b0325fc http://mevius.5ch.net/test/read.cgi/tech/1650651945/923
924: デフォルトの名無しさん (ワッチョイ 617b-8+ss) [sage] 2022/11/05(土) 22:46:20.49 ID:646uiMLL0 >>921 @はやっぱcommit履歴だよな? エントリポインタだけだと、commit履歴に出来ないんだよ。 今回はfast-forwardマージしてるから、 init<-0<-1<-2<-3<-4<-5 = master, develop で、単にエントリポイントだけなら master も develop も同じ 5 で区別がない。 当たり前だが両方とも HEAD~1 は4を指してる。 ただ、@{1}は、commit履歴だから、masterでは init を指し、developでは4を指す。 この、commit履歴情報はどこに記録されてるの?というのが俺の質問。 >>923 そこは理解出来てるはず。上記の通り。 問題はcommit履歴がどこにあるか。 http://mevius.5ch.net/test/read.cgi/tech/1650651945/924
925: デフォルトの名無しさん (ワッチョイ 09e4-chQ5) [sage] 2022/11/05(土) 22:50:12.27 ID:zDjINlW+0 >>922 masterブランチをdevelopブランチにマージする方法が git switch masterとgit merge developの連続実行だけではないし、 HEAD@{n}は適当なタイミングでGCされるから、 HEAD@{n}をそんな用途に使う奴はいない http://mevius.5ch.net/test/read.cgi/tech/1650651945/925
926: デフォルトの名無しさん (ワッチョイ 09e4-chQ5) [sage] 2022/11/05(土) 22:52:10.49 ID:zDjINlW+0 >>924 commit履歴がどこにあるか説明するのに使いたいから、git log --graph --branches --oneline してくれ http://mevius.5ch.net/test/read.cgi/tech/1650651945/926
927: デフォルトの名無しさん (ワッチョイ 09e4-chQ5) [sage] 2022/11/05(土) 22:54:11.54 ID:zDjINlW+0 @はcommit履歴じゃなくて、reflogの履歴 http://mevius.5ch.net/test/read.cgi/tech/1650651945/927
928: デフォルトの名無しさん (ワッチョイ 617b-8+ss) [sage] 2022/11/05(土) 22:57:39.34 ID:646uiMLL0 >>926 $ git log --graph --branches --oneline * 1a804d9 (HEAD -> master, develop) impl5 * ba4e962 impl4 * a32e11d impl3 * 8d9924f impl2 * 0f78740 impl1 * 47792a3 impl0 * b0325fc initial http://mevius.5ch.net/test/read.cgi/tech/1650651945/928
929: デフォルトの名無しさん (ワッチョイ 09e4-chQ5) [sage] 2022/11/05(土) 23:01:41.48 ID:zDjINlW+0 @{n}はカレントブランチのreflog履歴になるはず reflog履歴はブランチ毎に存在するので master@{n}とdevelop@{n}は違うハッシュになってるはず git reflog masterとgit reflog developで比べてみればわかる http://mevius.5ch.net/test/read.cgi/tech/1650651945/929
930: デフォルトの名無しさん (ワッチョイ 617b-8+ss) [sage] 2022/11/05(土) 23:04:26.02 ID:646uiMLL0 >>917,926 ちな --no-ff 版、 今出すと余計に混乱するかもだが。 $ git log --graph --branches --oneline * a5aaf72 (HEAD -> master, develop) Merge branch 'feature5' into develop |\ | * e03bcd0 impl5 |/ * 324df68 Merge branch 'feature4' into develop |\ | * c2634c4 impl4 |/ * 68ed20a Merge branch 'feature3' into develop |\ | * 5e12b99 impl3 |/ * 608e5d7 Merge branch 'feature2' into develop |\ | * 4660e46 impl2 |/ * 3924eae Merge branch 'feature1' into develop |\ | * 138d83f impl1 |/ * 7db4424 Merge branch 'feature0' into develop |\ | * 8877414 impl0 |/ * ec041f9 initial http://mevius.5ch.net/test/read.cgi/tech/1650651945/930
931: デフォルトの名無しさん (ワッチョイ 617b-8+ss) [sage] 2022/11/05(土) 23:08:22.79 ID:646uiMLL0 >>929 $ git reflog master 1a804d9 (HEAD -> master, develop) master@{0}: merge develop: Fast-forward b0325fc master@{1}: commit (initial): initial $ git reflog develop 1a804d9 (HEAD -> master, develop) develop@{0}: merge feature5: Fast-forward ba4e962 develop@{1}: merge feature4: Fast-forward a32e11d develop@{2}: merge feature3: Fast-forward 8d9924f develop@{3}: merge feature2: Fast-forward 0f78740 develop@{4}: merge feature1: Fast-forward 47792a3 develop@{5}: merge feature0: Fast-forward b0325fc develop@{6}: branch: Created from master ってことは、commit履歴はreflogにしか無いって事か? ならbrahchを消すとreflogも消されてcommit履歴が消えるが、マジ? これだとbranchの復活は本質的に無理なことになってしまう。 (他branchに断片的には残ってるんだけどさ) http://mevius.5ch.net/test/read.cgi/tech/1650651945/931
932: デフォルトの名無しさん (ワッチョイ 09e4-chQ5) [] 2022/11/05(土) 23:09:25.37 ID:zDjINlW+0 >>928 impl5のコミットオブジェクトの hash = 1a804d9 impl5のコミットオブジェクトの中には親のコミットオブジェクトimpl4の hash = ba4e962 が格納されている impl4のコミットオブジェクトの hash = ba4e962 impl4のコミットオブジェクトの中には親のコミットオブジェクトimpl3の hash = a32e11d が格納されている impl3のコミットオブジェクトの hash = a32e11d impl3のコミットオブジェクトの中には親のコミットオブジェクトimpl2の hash = 8d9924f が格納されている impl2のコミットオブジェクトの hash = 8d9924f impl2のコミットオブジェクトの中には親のコミットオブジェクトimpl1の hash = 0f78740 が格納されている impl1のコミットオブジェクトの hash = 0f78740 impl1のコミットオブジェクトの中には親のコミットオブジェクトimpl0の hash = 47792a3 が格納されている impl0のコミットオブジェクトの hash = 47792a3 impl0のコミットオブジェクトの中には親のコミットオブジェクトinitialの hash = b0325fc が格納されている initialのコミットオブジェクトの hash = b0325fc initialのコミットオブジェクトはルートなので親のコミットオブジェクトが存在しない つまり impl5のコミットオブジェクトの hash = 1a804d9 からたどっていけば、コミット履歴が全部わかる 親が複数存在する場合には複数の親のhashを格納する http://mevius.5ch.net/test/read.cgi/tech/1650651945/932
933: デフォルトの名無しさん (ワッチョイ 09e4-chQ5) [sage] 2022/11/05(土) 23:11:25.45 ID:zDjINlW+0 >>930 ¥で表示されるとちょっと見にくいが、慣れれば見やすい http://mevius.5ch.net/test/read.cgi/tech/1650651945/933
934: デフォルトの名無しさん (ワッチョイ 09e4-chQ5) [sage] 2022/11/05(土) 23:14:09.84 ID:zDjINlW+0 >>931 逆だ。コミットのつながりはコミットオブジェクトの中にしかない >>932 みたいにね それを説明してるのが >>902 http://mevius.5ch.net/test/read.cgi/tech/1650651945/934
935: デフォルトの名無しさん (ワッチョイ 09e4-chQ5) [sage] 2022/11/05(土) 23:16:52.31 ID:zDjINlW+0 >>930は最後のdevelopのマージが --no-ff になってないな 最後のも --no-ff にするともっと面白いぞ http://mevius.5ch.net/test/read.cgi/tech/1650651945/935
936: デフォルトの名無しさん (ワッチョイ 617b-8+ss) [sage] 2022/11/05(土) 23:18:09.46 ID:646uiMLL0 >>932 ごめん、それは分かってる。 それはグローバル履歴=gitオブジェクトを辿った履歴、だろ。 問題は、masterのcommitには b0325fc と 1a804d9 しかない、という情報が、 今のところ master の reflogにしか見あたらないんだよ。 だから、各branchを消したら、それ以前の gitオブジェクト は全部辿れるが、commit履歴は消失してしまう。 今のmasterみたいに、fast-forwardマージで中間をすっ飛ばしてきた、 という情報が無くなってしまうんだよ。 だから、branchを消す前の状態に完全には戻せない、という話。 だから、常識的に考えればもうちょっとましな何処かに保持してるはずなんだけど、無いんだ。 http://mevius.5ch.net/test/read.cgi/tech/1650651945/936
937: デフォルトの名無しさん (ワッチョイ 617b-8+ss) [sage] 2022/11/05(土) 23:21:56.96 ID:646uiMLL0 >>935 ほい $ git log --graph --branches --oneline * 2fb59f1 (HEAD -> master) Merge branch 'develop' |\ | * 25e1b95 (develop) Merge branch 'feature5' into develop | |\ | | * 4b27393 impl5 | |/ | * 9bfb8cc Merge branch 'feature4' into develop | |\ | | * c2a5b7d impl4 | |/ | * 02d2308 Merge branch 'feature3' into develop | |\ | | * f6d1cf7 impl3 | |/ | * 81e18bb Merge branch 'feature2' into develop | |\ | | * 01c3871 impl2 | |/ | * 5b57f48 Merge branch 'feature1' into develop | |\ | | * 0fe34d2 impl1 | |/ | * 6272da6 Merge branch 'feature0' into develop | |\ |/ / | * fe1b132 impl0 |/ * 832f464 initial http://mevius.5ch.net/test/read.cgi/tech/1650651945/937
938: デフォルトの名無しさん (ワッチョイ 09e4-chQ5) [sage] 2022/11/05(土) 23:23:27.84 ID:zDjINlW+0 >>936 FFマージしたらその情報は消滅するな --no-ff で全部マージすれば複数親のハッシュをもってるコミットオブジェクトの1番目だけたどればいける ^1 だけみていくね git log にはそれをやるオプションがあるはず >>930をそのオプションで表示すればこんな風に表示されるはず $ git log --graph --branches --oneline --オプション忘れた探せ * a5aaf72 (HEAD -> master, develop) Merge branch 'feature5' into develop * 324df68 Merge branch 'feature4' into develop * 68ed20a Merge branch 'feature3' into develop * 608e5d7 Merge branch 'feature2' into develop * 3924eae Merge branch 'feature1' into develop * 7db4424 Merge branch 'feature0' into develop * ec041f9 initial http://mevius.5ch.net/test/read.cgi/tech/1650651945/938
939: デフォルトの名無しさん (ワッチョイ 09e4-chQ5) [sage] 2022/11/05(土) 23:26:10.78 ID:zDjINlW+0 >>937 だとこう表示されるはず $ git log --graph --branches --oneline --オプション忘れた探せ * 2fb59f1 (HEAD -> master) Merge branch 'develop' * 832f464 initial http://mevius.5ch.net/test/read.cgi/tech/1650651945/939
940: デフォルトの名無しさん (ワッチョイ 617b-8+ss) [sage] 2022/11/05(土) 23:35:28.93 ID:646uiMLL0 >>938 $ git log --graph --branches --oneline --first-parent * a5aaf72 (HEAD -> master, develop) Merge branch 'feature5' into develop * 324df68 Merge branch 'feature4' into develop * 68ed20a Merge branch 'feature3' into develop * 608e5d7 Merge branch 'feature2' into develop * 3924eae Merge branch 'feature1' into develop * 7db4424 Merge branch 'feature0' into develop * ec041f9 initial >>939 $ git log --graph --branches --oneline --first-parent * 2fb59f1 (HEAD -> master) Merge branch 'develop' | * 25e1b95 (develop) Merge branch 'feature5' into develop | * 9bfb8cc Merge branch 'feature4' into develop | * 02d2308 Merge branch 'feature3' into develop | * 81e18bb Merge branch 'feature2' into develop | * 5b57f48 Merge branch 'feature1' into develop | * 6272da6 Merge branch 'feature0' into develop |/ * 832f464 initial http://mevius.5ch.net/test/read.cgi/tech/1650651945/940
メモ帳
(0/65535文字)
上
下
前
次
1-
新
書
関
写
板
覧
索
設
栞
歴
あと 62 レスあります
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.013s