1

I don't know much how to use rebase, but it seems the rebase only change the starting point to a more recent commit

in my case I did stuff on branch test that was pushed, another person pulled the changes B to E In the mean time I changed slightly a commit, and I deleted (bad idea) my remote branch to recreate one with the same commits

so because of this now it looks after a merge:

A---B---C---D---E--F--G--H  master
 \--B'--C'--D'--E'/    test

B and B' are the same, at same time, same commit message..., C, C' also, ..D and D' , E and E'

Is there other solution than git rebase -i, I tried it but you lose other branches merge history

I would actually like to remove B, C, D, E, Is it possible if the branches are already merged?

I have no right to push on remote master, only pulling

I tried pruning but those unecessary commits are not removed since they point to others I would really like to rebase master A onto master E', if it's possible

thx for tips

edit : else, how could a person with push right could fix permanently that situation?

I can fix this by

git reset --hard A
git pull repo1 test (where test still is at E')
git rebase --onto F A master

but if the admin pulls it, I guess it will have no effect?, he should do this manip himself right before any other user pull from this mess?

4

1 回答 1

3

摆脱 F 处不需要的合并的最简单方法是创建一个移植文件并在那里放一行<hash of F> <hash of E'>然后用 gitk 检查历史看起来像你想要的那样。如果一切看起来都是文件,下一步是通过重写最近的提交来使移植永久化:git filter-branch --tag-name-filter cat -- <hash of A>..master最后将重写的提交强制推送到存储库git push -f

于 2012-07-30T20:38:57.243 回答