2

enter image description here

I want to cancel the blue commit
Is there a effective way to do it???
Thanks!

2
  • 1
    git revert Commented Mar 27, 2013 at 12:33
  • git rebase -i Commented Mar 27, 2013 at 12:33

3 Answers 3

4

I think that you have a couple options for getting rid of that commit (and some are mentioned in the comments above):

  1. git revert <commit_id> - this will show in the git history that you specifically removed the code
  2. git reset --hard <commit_id_before_your_commit> then cherry pick the commits you want to keep git cherry-pick <commit_id_to_keep>x2 and finally force push to the origin
  3. git rebase -i origin/wix - interactive rebase the branch, and SKIP that commit when you get to it

The latter two options will not show any trace of that commit in your branch history, where as the first option will show that the commit existed but you opted to remove it.

Sign up to request clarification or add additional context in comments.

Comments

2

You can do a revert

git revert <commit-id> 

Comments

0

Additionally to the revert:

If you haven't pushed the changes yet (the line saying remotes/origin/wlx suggesting that):

> git rebase -i remotes/origin/wlx 

This will open an editor asking you what to do with the commits. Deleting any of the lines will drop that commit from the history.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.