Tob*_*ler 45 git history repository undelete
在另一个问题上使用Chris的答案,我可以将快照历史记录添加到我的git存储库中.由于其中一个文件不是我的历史记录的一部分,而只是在快照中,因此第一个原始提交现在也包含此文件的删除.我该怎么撤消?
起初我认为这与我如何从git的历史记录中删除敏感文件相反,但实际上我不想将文件插入历史记录,只是从历史记录中删除删除.
kub*_*ubi 68
git checkout <commit> <filename>
Run Code Online (Sandbox Code Playgroud)
Tob*_*ler 53
我知道了:
git tag originalHead # just in case
git rebase -i <id of the parent of the commit that deleted the file>
# change pick to edit for that commit
git checkout <id of the previous commit> <filename> # thanks for reminding, kubi
git commit --amend
git rebase --continue
git tag -d originalHead
Run Code Online (Sandbox Code Playgroud)
编辑不幸的是,这将留下旧时间轴上的所有标签,请参阅此处
| 归档时间: |
|
| 查看次数: |
29066 次 |
| 最近记录: |