Git 拉取 removes/deletes 个本地文件
Git pull removes/deletes local files
当我 git 添加 -A 然后 git 提交 -m 然后 git状态结果是:
你的分支和 'origin/gh-pages' 有分歧,
并且分别有 1 和 1 个不同的提交。
(使用“git pull”将远程分支合并到你的)
然后我执行 git 拉取 ,结果是一堆以前提交和推送的文件现在从我的本地存储库中删除了?
没有其他人在这个存储库中工作,我最近完成 pulls 没有这个问题?
检查 origin/gh-pages
中引入的差异:
git show origin/gh-pages
# or a shorter output which lists which files were modified :
git show --name-status origin/gh-pages
最后一次提交很可能删除了上述文件。
关于“修复”:检查为什么额外的提交会落在您的远程仓库上(既然您说您是唯一一个在该仓库上工作的人,那么您应该是推动它的人)。
如果该提交是某些错误操作的结果:删除该提交(也许您可以 push --force
您当前的本地分支?)或编辑该提交以修复它:
git checkout -b wip origin/gh-pages
# some fixing here ...
git push origin wip:gh-pages # possibly with the --force flag
当我 git 添加 -A 然后 git 提交 -m 然后 git状态结果是:
你的分支和 'origin/gh-pages' 有分歧, 并且分别有 1 和 1 个不同的提交。 (使用“git pull”将远程分支合并到你的)
然后我执行 git 拉取 ,结果是一堆以前提交和推送的文件现在从我的本地存储库中删除了?
没有其他人在这个存储库中工作,我最近完成 pulls 没有这个问题?
检查 origin/gh-pages
中引入的差异:
git show origin/gh-pages
# or a shorter output which lists which files were modified :
git show --name-status origin/gh-pages
最后一次提交很可能删除了上述文件。
关于“修复”:检查为什么额外的提交会落在您的远程仓库上(既然您说您是唯一一个在该仓库上工作的人,那么您应该是推动它的人)。
如果该提交是某些错误操作的结果:删除该提交(也许您可以 push --force
您当前的本地分支?)或编辑该提交以修复它:
git checkout -b wip origin/gh-pages
# some fixing here ...
git push origin wip:gh-pages # possibly with the --force flag