git - I need to delete a commit to a fork -


ok, did stupid.

  • i forked repo supposed contribute to.
  • so literally created file called "blafile" check can commit (obviously did not understand fork is) , committed message "check can commit".
  • i pushed github forked repo , forgot it.
  • i started fixing bug on next day.
  • i committed fix , pushed forked repo message "fixed bug xyz".

now wanted issue pull request, , of sudden see "check can commit" commit. i'd rather not appear on pull request. :)

can entirely delete commit? can issue pull request on single commit or pull commits?

i know can locally git reset --hard head~1(it's small fix redo quickly) fixes local repo, not github (forked) repo.

lots of options.

the best option make new branch , cherry-pick fix branch:

git checkout -b my-fix-branch origin/master git cherry-pick master git push -u origin my-fix-branch 

then pull request my-fix-branch on github. (this assumes working branch named master, based off remote master; change branch names appropriate).


if nobody has pulled or cloned fork, can rewrite history forcefully. git rebase -i head~2 , delete offending commit, git push --force. break other repo based on fork, not if suspect else using repo.


Comments