を使用して更新する1つのブランチに4つの線形コミットがありgit rebase --interactive
ます。彼らです:
small fixes to irrelevant files
FeedbackViewController tests
live feedback tests
poke build bot
「FeedbackViewController」というタイトルのコミットをなんとか失いました。今私は持っているだけです:
small fixes to irrelevant files
live feedback tests
poke build bot
このコミットをどこで失ったのですか?3番目に古いコミットの場所でそれを取り戻すにはどうすればよいですか?これがの出力ですgit reflog --date=relative
:
b2681e4 HEAD@{21 seconds ago}: rebase -i (finish): returning to refs/heads/end
b2681e4 HEAD@{24 seconds ago}: checkout: moving from end to b2681e4
b2681e4 HEAD@{31 minutes ago}: rebase finished: returning to refs/heads/end
b2681e4 HEAD@{31 minutes ago}: rebase: small fixes to irrelevant files
6f80728 HEAD@{31 minutes ago}: rebase: live feedback tests
56b5212 HEAD@{31 minutes ago}: rebase: poke build bot
10bc997 HEAD@{33 minutes ago}: checkout: moving from end to 10bc997faa7d5cad52c5b3f1dc25816c13220187^0
422f15a HEAD@{25 hours ago}: rebase finished: returning to refs/heads/end
422f15a HEAD@{25 hours ago}: rebase: small fixes to irrelevant files
79d7596 HEAD@{25 hours ago}: pull --rebase: live feedback tests
52072ec HEAD@{25 hours ago}: pull --rebase: poke build bot
62c8870 HEAD@{25 hours ago}: checkout: moving from end to 62c887017d969d98ec5874698c82f94523fe5ac6^0
ca2f134 HEAD@{25 hours ago}: rebase finished: returning to refs/heads/end
ca2f134 HEAD@{25 hours ago}: rebase: small fixes to irrelevant files
8bce052 HEAD@{25 hours ago}: rebase: FeedbackViewController tests
d581615 HEAD@{25 hours ago}: rebase: live feedback tests
c9adb82 HEAD@{25 hours ago}: rebase: poke build bot
e556052 HEAD@{26 hours ago}: checkout: moving from end to e556052f0db5c674e4145e56001df08cb809f936^0
399758d HEAD@{26 hours ago}: rebase finished: returning to refs/heads/end
399758d HEAD@{26 hours ago}: rebase: small fixes to irrelevant files
3f6385d HEAD@{26 hours ago}: rebase: FeedbackViewController tests
ba01791 HEAD@{26 hours ago}: rebase: live feedback tests
e9159db HEAD@{26 hours ago}: rebase: poke build bot
追加された質問:
私はこれらの行に特に興味があります:
422f15a HEAD@{25 hours ago}: rebase finished: returning to refs/heads/end
422f15a HEAD@{25 hours ago}: rebase: small fixes to irrelevant files
79d7596 HEAD@{25 hours ago}: pull --rebase: live feedback tests
52072ec HEAD@{25 hours ago}: pull --rebase: poke build bot
どのようにpull --rebase
しrebase
て同じ行にたどり着きましたか?通常、を実行するpull --rebase
と、次のように4つすべてが一度に更新されます。
18cb678 HEAD@{2 days ago}: rebase finished: returning to refs/heads/end
18cb678 HEAD@{2 days ago}: pull --rebase: small fixes to irrelevant files
744ce78 HEAD@{2 days ago}: pull --rebase: FBFeedbackViewController tests
7fd9af4 HEAD@{2 days ago}: pull --rebase: live feedback tests
1b7aa06 HEAD@{2 days ago}: pull --rebase: update feedback when MQTT message is received
解決策:
git reflog branch-name
ではなくを使用するgit reflog
ことで、リベース操作全体に対して1つのエントリを表示できるため、プロジェクトでその状態に戻ることができます。
の出力はgit reflog branch-name --date=relative
次のようになります。
b2681e4 end@{71 minutes ago}: rebase finished: refs/heads/end onto 10bc997faa7d5cad52c5b3f1dc25816c13220187
422f15a end@{26 hours ago}: rebase finished: refs/heads/end onto 62c887017d969d98ec5874698c82f94523fe5ac6
ca2f134 end@{26 hours ago}: rebase finished: refs/heads/end onto e556052f0db5c674e4145e56001df08cb809f936
399758d end@{26 hours ago}: rebase finished: refs/heads/end onto 9276926e7fe7417db622e42da44e54eac4db1f85
a8ca29d end@{2 days ago}: rebase -i (finish): refs/heads/end onto bfe8d25
18cb678 end@{2 days ago}: rebase finished: refs/heads/end onto 967a525790be38e06b42ff314f47821ec867403f
21c2da4 end@{2 days ago}: rebase finished: refs/heads/end onto f94d81aa5c3ecf6445db06692dee4f6c40d96c0b