我在远程分支中有一个提交,我们称该分支为“错误”,该分支需要删除。合并请求已关闭,没有在上游任何地方合并。
远程分支本身已被删除,但是我仍然可以在关闭请求的差异中看到提交。
如果我从本地的合并请求引用中拉出,我可以获得想要消失的内容。
我已经尝试过git-filter-branch和BFG,尽管它们都似乎成功删除了我试图摆脱的引用,但是我仍然可以在合并请求的差异中看到提交。我不是项目所有者,因此无法明确删除合并请求。
有什么办法可以做到这一点?我还尝试创建一个与已删除分支同名的本地分支,从合并提交中拉出,恢复到问题提交之前,然后强制推送。也不行。
我已经使用的资源来完成此任务:
Using repo : /Users/xxx/Code/my-company-repo.git
Found 2 objects to protect
Found 9 commit-pointing refs : HEAD, refs/heads/master, refs/heads/xxxxx, ...
Protected commits
-----------------
These are your protected commits, and so their contents will NOT be altered:
* commit xxxxxxxx (protected by 'HEAD')
Cleaning
--------
Found 33 commits
Cleaning commits: 100% (33/33)
Cleaning commits completed in 96 ms.
Updating 2 Refs
---------------
Ref Before After
-------------------------------------------------
refs/merge-requests/1/head | xxxxxxxx | xxxxxxxx
refs/merge-requests/1/merge | xxxxxxxx | xxxxxxxx
Updating references: 100% (2/2)
...Ref update completed in 40 ms.
Commit Tree-Dirt History
------------------------
Earliest Latest
| |
..DDD............................
D = dirty commits (file tree fixed)
m = modified commits (commit message or parents changed)
. = clean commits (no changes to file tree)
Before After
-------------------------------------------
First modified commit | xxxxxxxx | xxxxxxxx
Last dirty commit | xxxxxxxx | xxxxxxx
Deleted files
-------------
Filename Git id
-------------------------------------
xxxxxxxxxxxxxx | xxxxxxxx (1.5 KB)
In total, 5 object ids were changed. Full details are logged here:
/Users/xxx/Code/my-company.git.bfgreport/2020-10-12/15-52-26
BFG run is complete! When ready, run: git reflog expire --expire=now --all && git gc --prune=now --aggressive```
因此,我遵循了这些说明,但是几个小时后,我仍然在合并中看到它。重新运行该命令后,它从bfg的一侧消失了,因为我第二次收到此命令,它不再可见:
Using repo : /Users/xxx/Code/xxx.git
Found 2 objects to protect
Found 9 commit-pointing refs : HEAD, refs/heads/master, refs/heads/xxx, ...
Protected commits
-----------------
These are your protected commits, and so their contents will NOT be altered:
* commit xxxxx (protected by 'HEAD')
Cleaning
--------
Found 33 commits
Cleaning commits: 100% (33/33)
Cleaning commits completed in 166 ms.
BFG aborting: No refs to update - no dirty commits found??
我看到可以解决我的情况的事物是
更新1:
所以从BFG方面来看,这是部分成功的。当我尝试直接从合并引用中拉出时,不再获得问题文件。
但是在缓存的差异中仍然可见...
更新2:
我对该项目拥有维护者特权