How to change past commit to include a missed file?

后端 未结 4 930
日久生厌
日久生厌 2021-01-29 23:02

I have committed a change and forgot to add a file to the change set. After other commits, I realized the file is now missing from a HEAD^4 commit.

How do I

4条回答
  •  旧时难觅i
    2021-01-29 23:56

    Use git rebase --interactive HEAD~4 and set edit option for the commit you'd like to amend.

    Remember that you should not modify commits pushed to the remote repository this way. It's better to add a new commit with missing file in that case.

提交回复
热议问题