【发布时间】:2021-01-25 01:01:53
【问题描述】:
我试图做 rebase 以将提交合并为一个提交,但我最终编写了更多提交,现在这一切都搞砸了。
这是树:
在运行git status 时,我得到了
On branch master
Your branch is up to date with 'origin/master'.
Last commands done (5 commands done):
pick 49147e5 squash
pick 2c48387 Commit
(see more in file .git/rebase-merge/done)
Next commands to do (13 remaining commands):
pick fddd4c7 commit
pick 5f01f80 commit
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch 'master' on '1550461'.
(use "git commit --amend" to amend the current commit)
(use "git rebase --continue" once you are satisfied with your changes)
nothing to commit, working tree clean
在运行git log --oneline 时,我得到:
Merge branch 'master' of .....
49147e5 squash
0310431 commit 4 which was PR
d4be53f commit 6
ea24a2d commit 5
1550461 commit 3
fc8115a commit 2
212138a commit 1
72d8fff Merge pull request #64 from branch 1
c5ad199 commit 14
2a6ceaf commit 13
6660dbf commit 12
b6c863e commit 11
88788e6 commit 10
5bbe8a7 commit 9
9731810 commit 8
1e4ac6b commit 7
ce3817c Merge branch 'master' of .... into branch 1
ec4c3e9 commit 6
5b8900b commit 5
d10eec9 commit 4 which was PR
5f01f80 commit 3
fddd4c7 commit 2
02ebbc8 Merge branch 'master' of ....into branch 1
3995cf2 pr changes v2
2c48387 commit 1
我是怎么搞砸的:
从72d8fff,我做了git rebase -i HEAD~7 or 8,git pull,然后是git push。我想将squashd10eec9 之后的所有提交合并为一个提交,但我想我最终写在 HEAD 之上。
我想先做git reset --hard 72d8fff 然后git push origin HEAD --force 这至少会让我回到我开始的地方。
请保存。
【问题讨论】:
标签: git rebase squash git-squash