0

I cloned a sample project, but when I check git log I see there are about 15 commits.

Commits 10 and 8 caused problems to the project and for now I would like to remove/ignore/skip changes made in commits 10 and 8.

How can I do this? (I don't want to merge or push these changes).

random
  • 9,774
  • 10
  • 66
  • 83
user2622247
  • 1,059
  • 2
  • 15
  • 26
  • You are best off to `git revert` the specific commits. You can then revert the revert to put them back. – AD7six May 17 '14 at 13:03

1 Answers1

1

You can run git rebase -i hash_to_your_7th_commit and delete commits 8 and 10 but you are most likely going to get lots of conflicts.

Another option is git checkout -b 7th_commit and cherry-pick commits 9 and from 10 to 15. Keep in mind that if you give a range 10..15 cherry-pick will start at 11.

I would recommend though to just revert these two commits because you may change your mind about pushing it someday.

kaman
  • 376
  • 1
  • 8