Hesam
Hesam

Reputation: 53610

how to pull out a commit from git history?

I've confused how to fix my problem. My git history is like this (commit id):

commit: f8ae2 -> parent: 71bf9 
commit: 71bf9 -> parent: f67c0 
commit: f67c0 -> parent: 5b18a 
commit: 5b18a -> parent: 9e111 
commit: 9e111 -> parent: ce53b
commit: ce53b -> parents: f1b1a, 2055e
commit: f1b1a -> parent: 2055e
commit: 2055e

Since I'm the only person who works on a branch - and still not merged in upstream - I want to pull out or remove commit: f1b1a from history. Therefore, I want commit: ce53b has only 2055e as its parent.

What should I do? Any suggestion would be appreciated. thanks.

Upvotes: 3

Views: 109

Answers (1)

Nils Werner
Nils Werner

Reputation: 36839

You can use an interactive rebase for this: run

git rebase -i --onto 2055e 2055e

then delete each line you don't want to have in your history.

Upvotes: 3

Related Questions