Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git remove a commit from pull request

Tags:

I'm newbie to open source contribution, so it one of my first tries.

I developed a library (gem) called validates: https://github.com/kaize/validates/

I made 2 branches through git checkout -b branch_name:

https://github.com/kaize/validates/pull/20 & https://github.com/kaize/validates/pull/19, and make commits for them, but, you can see that ip-validator pull request have a commit Blank validator 399cdd7.

What I need to do to remove it from this pull request (and still place in blank validator branch)?

Please help me with make world better, guys!

like image 576
asiniy Avatar asked Dec 24 '13 18:12

asiniy


People also ask

How do I remove a specific commit in git?

In order to remove a specific file from a Git commit, use the “git reset” command with the “–soft” option, specify the commit before HEAD and the file that you want to remove.

How do I remove a commit?

Removing the last commit To remove the last commit from git, you can simply run git reset --hard HEAD^ If you are removing multiple commits from the top, you can run git reset --hard HEAD~2 to remove the last two commits.


1 Answers

On the ip-validator branch, you'd do git rebase -i HEAD~2 - this will start an interactive rebase back two commits on that branch.

At this point, you'll get an editor open with options seen here: https://help.github.com/articles/interactive-rebase

Simply put, to remove that commit, just delete the commit line in the editor, save that editor file, and git will create a new commit without the commit you removed.

like image 78
CDub Avatar answered Oct 03 '22 17:10

CDub