在特定的一个之后删除所有提交?或者在特定的提交中克隆 [英] Removing all commit after a specific one? Or cloning at a specific commit
问题描述
如果我从Github上下载了一些东西,并且我想在本地擦除在给定提交之后发生的所有事情,我该怎么做?
或者相反,是我有可能在某个时间点下载/克隆存储库? (这将是几个月大的时间,但我不希望任何一个特定点出现在我的仓库中的变化)
提交,说它是 abc123def
。 Simone基本上是正确的,但有一个更简单的方法。首先,如前所述,克隆将总是克隆所有内容,而你无法帮助克隆。但是,感谢git的极速,这通常不是问题。克隆后,只需检查你的分支并运行:
git reset --hard abc123def
针对SE专业人员的问题:这应该是对Simone答案的修改吗?
If I download something from Github, and I want to locally wipe out everything that occurred after a given commit, how can I do this?
Or conversely, is it possible for me to download/clone a repository at a certain point in time? (it will be a few months old, but I don't want any of the changes after a specific point to show up in my repository at all)
I know the commit, say it is abc123def
.
Simone is basically right, but there is a simpler way. First, as said a clone will always clone everything and you can’t help that. But thanks to git’s extreme speed that’s usually not a problem. After the clone, simply check out your branch and run:
git reset --hard abc123def
question for the SE pros: should this rather have been an edit to Simone’s answer?
这篇关于在特定的一个之后删除所有提交?或者在特定的提交中克隆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!