[英]How can I remove all local git branches and clone all new?
I am having issues with git
on my local machine. 我在本地计算机上的git
有问题。 I would like to delete all branches on my machine and start all over again by cloning the project from git. 我想删除计算机上的所有分支,并通过从git克隆项目来重新开始。
Note: that I don't want to delete the branches on GitHub.com. 注意:我不想删除GitHub.com上的分支。 Delete locally only. 仅在本地删除。
只要您可以放弃在本地完成的所有工作,就可以删除项目的根文件夹。
Several alternatives: 几种选择:
Save a backup of your local work, and go back to the Github version: 保存本地工作的备份,然后回到Github版本:
Undo all your local changes, and go back to the last local commit: 撤消所有本地更改,然后返回上一次本地提交:
git reset --hard HEAD
Reset your local project to the Github version: 将本地项目重置为Github版本:
Reset local repository branch to be just like remote repository HEAD 将本地存储库分支重置为类似于远程存储库HEAD
git fetch origin git reset --hard origin/master git clean -f
It depends on exactly what you're trying to accomplish. 这完全取决于您要完成的工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.