简体   繁体   中英

git rebase -i HEAD~5 and pull request with not mine commits

I just did git rebase -i HEAD~5, wanted to fixup/squash 2 of my commits... then had to force push and now my remote branch has one commit of mine and 4 of someone else. WTF. please help, how to remove the other 4 commits of someone's else?! I just want it to have that one commit of mine.

When you do a git rebase -i HEAD~5 you also get all the commits in a merge.
You had a merge commit so you had more commits that the actual 5 commits.

For example:
here is the log screenshot + the git rebase -i HEAD~5 which results in 17 commits.

You can follow the log and count the 5 commits on the most left branch and you will see that all the other commits are "collected" on the way as well.

在此处输入图片说明

设法返回git reflog并从那里修复它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM