の ToDo テキストには次の内容が含まれていますgit rebase -i HEAD~2
:
pick 56bcce7 Closes #2774
pick e43ceba Lint.py: Replace deprecated link
# Rebase 684f917..e43ceba onto 684f917 (2 command(s))
#
...
ここで、最初のもの ( 56bcce7
) を圧縮し、最初のものの前に「s」を追加して 2 番目のものを選択しようとすると、次のエラーが発生します。
Cannot 'squash' without a previous commit
誰か、それが何を意味するのか、また、どうすればいいのかを説明してくれませんか?
最初のコミット( )を圧縮し、2番目のコミット56bcce7
( )を「選択して書き換え」たいe43ceba
ベストアンサー1
私も同様の問題を抱えていましたが、次のように解決しました。
これは私が潰したいコミット グループです:
1 s 01cc5a08 Removes open div
2 s a2b6eecf Restores old fonts
3 s 603479ff Cleans left out div
4 pick 5afdbc33 Update: show logo on landing page
5 s 04c1cb13 change version of dev and prod from 1 to 2
6 s bbe6a8f8 Update: show logo on landing page if they have one
7 s c0d6008a Adds check for C users
ご覧のとおり、私は4番を希望していましたが、1、2、3番は以前にコミットされていませんでした。押しつぶす。 従って以前のコミットなしでは「squash」できませんエラー。
私の解決策はr
、# r, reword = use commit, but edit the commit message
私のコミット リストは次のようになりました。
1 r 01cc5a08 Removes open div
2 s a2b6eecf Restores old fonts
3 s 603479ff Cleans left out div
4 s 5afdbc33 Update: show logo on landing page
5 s 04c1cb13 change version of dev and prod from 1 to 2
6 s bbe6a8f8 Update: show logo on landing page if they have one
7 s c0d6008a Adds check for C users
保存後、対話型シェルは選択したコミットの言い換えを要求しました。
その後、コミット ログは単一のコミットになり、コミット履歴がより明確になりました。