My code is based on a cherry-pick I have done to another patch. I pushed it by mistake as the other patch is not ready yet. So in gerrit I see the other patch files as well. How do I make now my pushed patch re-based without the other files that came in from the other patch?
Asked
Active
Viewed 1,131 times
1 Answers
0
To restore the branch to where it was before the cherry-pick, do this (where n
is the number of cherry-picked commits):
git reset --hard HEAD~n
git push -f
Note that a force-push might mess up the commit history for anyone who has pulled your branch after your cherry-pick.
If you want to cherry-pick parts of a commit (just the one file), it can for instance be done this way:
git cherry-pick <hash>
git reset --soft HEAD~1
//revert unwanted changes and commit
git push

Tobb
- 11,850
- 6
- 52
- 77