我做了一些测试提交(测试提交挂钩),并始终将索引重置为最后一次正常提交。现在这些陈旧的提交仍然存在:从Git中删除陈旧的提交
> git reflog
fcdabf7 [email protected]{0}: reset: moving to fcdabf7e01845d6f000fc3cef2edc999c57a7e29
5c97564 [email protected]{1}: commit: t
fcdabf7 [email protected]{2}: reset: moving to fcdabf7e01845d6f000fc3cef2edc999c57a7e29
ae52246 [email protected]{3}: commit: t
fcdabf7 [email protected]{4}: reset: moving to fcdabf7e01845d6f000fc3cef2edc999c57a7e29
c58aeef [email protected]{5}: commit: t
fcdabf7 [email protected]{6}: reset: moving to fcdabf7e01845d6f000fc3cef2edc999c57a7e29
3a2cc3b [email protected]{7}: commit: test
我该如何删除它们?为了技术上的理解:如果我让他们独自一人,如果我推一推,他们会被推到上游回购区吗?
Afaik您将只推送可通过您推送的分支到达的提交。如果它不在'git log'中,则不会被推送。也可以尝试用'git gc'来清除无法访问的提交。 – ZeissS
我尝试过'git gc --aggressive --prune = 2015-01-01',但是这并没有将它们从reflog中移除。 – AndiDog
请参阅http://stackoverflow.com/q/1904860/11343 – CharlesB