First:
git rebase -i target_commit_hash^
and edit the commit, unstage wanted line (git reset HEAD -p
) and amend the commit. Then stage the file with this one line and save in a separate commit. After that continue the rebase.
Then do rebase again:
git rebase -i target_commit_hash^
and move the commit with your one line to the top of the tree.
Then:
git reset HEAD^
this will remove the temporary commit with your one line and make this line as unstaged.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…