如何重新启动一个git仓库 [英] how to restart a git repository

查看:146
本文介绍了如何重新启动一个git仓库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个拥有git的新手 - 并且刚刚意识到.gitignore的变化不会对回溯追溯地处理 - 而是影响未来的'git add *'命令等等。一旦这些文件在repo中 - 他们必须手动删除。



在这一点上 - 我想完全杀死这个回购 - 重新开始(保存我的配置,等等)。



这是否容易或会导致重大问题?可以备份 - 然后删除.git文件夹 - 并开始新鲜?

另外 - 对于其他新手刚开始在git我会建议观看这个视频。它没有描述如何使用git,而是描述了git如何在内部工作 - 并且我发现它开启了眼界。它的名字是4岁以上的git。 http://blip.tv/open -source-developers-conference / git-for-ages-4-and-up-4460524



解决方案:



我想感谢大家的意见和指导。



我曾尝试删除.git目录 - 然后重新启动。我不知道如何 - 但是当我尝试着手开始时 - 它完全意识到它的历史 - 并且简言之重新创建了自己,包括所有以前的提交和跟踪。



我独自离开了这一切 - 并开始重组,重组和清理。更改文件夹结构 - 删除不必要的项目,文件夹等。 - 并在过程中 - 意识到我可以做些什么来删除我不想跟踪的文件(但仍希望它们存在于树中)。

b
$ b

我有效地移动了每个文件夹等,当我提交时 - git删除了移动/删除文件的跟踪。但由于.gitignore我现在有 - 它没有拿起或跟踪移动文件夹中的文件。



我正在做的大部分工作是准备开始一个全新的git回购。在这个过程的最后阶段,我发现了我 - 我不想跟踪的大部分内容都已被有效地删除以供回购。所以发生了什么 - 并做了一些调整 - 现在一切正常。

再次 - 谢谢你。我喜欢git!

解决方案


可以备份 - 然后删除.git文件夹 - 新鲜?


是的。这就是它的全部。

一些非常奇特的设置可能在工作目录之外有.git文件夹;但除此之外,.git文件夹包含所有的信息都是git。编辑:对于那些可能没有阅读完整个问题的人: warning:this将删除您的所有git历史


I am a newbie with git – and just realized changes to the .gitignore does not process against the repo "retroactively" – rather affect future ‘git add *’ commands and the like. Once the files are in the repo – they must be manually removed.

At this point – I would like just kill this repo entirely – and start over (saving my config, etc.).

Is this easily possible or would it cause major problems? Can backup – then delete the .git folder – and start fresh?

Also – for others newbies just starting in git I would suggest viewing this video. It describes not how to use git – but how git works internally – and I found it eye opening. It’s titled git for ages 4 and up. http://blip.tv/open-source-developers-conference/git-for-ages-4-and-up-4460524

Resolution:

I want to thank everyone for their input and guidance.

I did try to delete the .git directory - and restart. I am not sure how - but when I did try to start it over - It started up with full awareness of it's history - and in short recreated itself to include all the previous commits and tracking.

I left that alone - and set about reorganizing and restructuring and cleaning. Changing the folder structure - deleted unnecessary projects, folders, etc.. - and in the process - realized what I could do to remove the files I did not want tracked (but still wanted them present in the tree).

I effectively moved every folder, etc. and when I would commit this - git removed the tracking on the moved / deleted files. But because of the .gitignore I now had - it did not pick up or track the files in the moved folders.

Much of what I was doing was in preparation to start a whole new git repo. Late in the process I't dawned on me - most of what I did not want tracked had been effectively been removed for the repo. So took what had happened - and made a few more adjustments - and all is fine now.

Once again - thank you. I'm loving git!

解决方案

Can backup – then delete the .git folder – and start fresh?

Yes. This is all there is to it.

Some really exotic set-ups might have the .git folder outside of the working directory; but otherwise the .git folder contains all the information there is wrt git. If you remove that, you remove all history, git-metadata and such.

Edit: for those who might not have read the entire question: warning: this will remove all your git history.

这篇关于如何重新启动一个git仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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