How can I clean up a broken history with git-tfs

喜夏-厌秋 提交于 2019-12-06 14:24:41

Yes, you've got half of the answer! You should reset the tfs/default to a previous step and fetch. There is no way to do that in git (if I know well) because that's not a normal case but we could still do that by editing git files... it's easy!

If you are sure that you don't want to keep the B and C commits (otherwise save them temporary by creating a local branch), just do the following:

  • Go into your .git folder and look for the file /refs/remotes/tfs/default
  • edit the file and replace the sha in the file with the sha of commit A
  • fetch from tfs

And that should be good!

edit: can also be done with command line git update-ref tfs/default SHAofcommitA

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!