我有一个项目,其中包含我自己作为一种模板项目使用的另一个项目的跟踪.现在我想完全从存储库中删除这些跟踪.基本上我想切断旧的垃圾提交.所以我有
A -- B -- C -- D -- E -- F
Run Code Online (Sandbox Code Playgroud)
并希望获得类似的东西
D -- E -- F
Run Code Online (Sandbox Code Playgroud)
有A -- B -- C
被完全从资源库中删除.
ver*_*nzt 26
假设master
是在提交F
:
# create a new branch with D's content
$ git checkout --orphan temp <d-sha1>
$ git commit
# rebase everything else onto the temp branch
$ git rebase --onto temp <d-sha1> master
# clean up
$ git checkout master
$ git branch -d temp
Run Code Online (Sandbox Code Playgroud)
如果您想彻底删除旧的松散对象(A
,B
,和C
),首先要确保你有你想要什么.这不能被撤消. 一旦确认了它是你想要的,运行:
$ git reflog expire --expire=now --all
$ git gc --prune=now
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4695 次 |
最近记录: |