简体   繁体   English

如何删除所有本地git分支并克隆所有新分支?

[英]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: 几种选择:

  1. Save a backup of your local work, and go back to the Github version: 保存本地工作的备份,然后回到Github版本:

    • Rename your current project directory and re-clone from Github. 重命名您当前的项目目录,然后从Github重新克隆。
  2. Undo all your local changes, and go back to the last local commit: 撤消所有本地更改,然后返回上一次本地提交:

    • git reset --hard HEAD
  3. Reset your local project to the Github version: 将本地项目重置为Github版本:

It depends on exactly what you're trying to accomplish. 这完全取决于您要完成的工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM