重置本地git存储库 [英] Reset local git repository

查看:543
本文介绍了重置本地git存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几天前,我在Github上创建了一个存储库,然后按照步骤将现有的解决方案添加到它。我不知道我做了什么错误,但是在几次随机的'git add'命令之后,我现在在github上获取了windows的消息:

 未能同步此分支。 
您可能需要打开一个shell并调试此回购的状态。

不会发生。

更好的主意是我在github上删除了存储库,并从本地存储库重新开始。我知道如何删除github上的仓库(我知道这很容易,因为我已经做过一次)。我不知道如何从本地重新开始。是否有一个git命令,基本上是git uninit或git deconstruct repository? 解决方案

在隐藏的 .git 文件夹中的仓库根目录下。简单地删除该文件夹, rm -rf .git ,就好像从未有过回购。


A few days ago I created a repository on Github, then followed the steps to add my existing solution to it. I have no idea what I did wrong, but after a few random 'git add' commands and whatnot, I now get the message in github for windows:

failed to sync this branch.
You might need to open a shell and debug the state of this repo.

Not gonna happen.

A better idea is that I delete the repository at github and start over with my local repository. I know how to delete the repository on github (I know it is easy because I have already done this once.) I am not sure how to start over locally. Is there a git command that is basically "git uninit" or "git deconstruct repository" ?

解决方案

Git stores everything about a repo at the repo's root in the hidden .git folder. Simply deleting that folder, rm -rf .git makes it as if there never was a repo there.

这篇关于重置本地git存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆