0

enter image description here

Okay I started out a new angular module (call it radio) by mirror cloning another module (contact list) ... Bad mistake because now, I have tags, branches and commits that have nothing to do with the "new" module ... Please see the image.

I managed to remove the branches and tags easily.

Can someone please help me delete EVERY commit before commit 2912 starting at Chris's last commit ... The list has hundreds of commits and I cannot delete each individually.

Thank you in advance !

T M
  • 516
  • 5
  • 18
  • Possible duplicate of [Revert Git repo to a previous commit](http://stackoverflow.com/questions/4114095/revert-git-repo-to-a-previous-commit) – warkentien2 Jun 08 '16 at 12:13
  • I am actually not trying to revert the previous state ... I am happy with the top 7 commits by Thembelani. What I want to do it remove the previous commits starting with Chris's most recent commit – T M Jun 08 '16 at 13:21
  • I can't understand what you want. You can revert specific files to previous commits. If all you wan't to do is remove the commit message be clearer. – warkentien2 Jun 08 '16 at 20:15
  • I want to keep the top 8 commits and delete the rest of the commits from history ... – T M Jun 09 '16 at 12:26
  • @Tembelati M you mean to erase previous commit messages but keep commited code? (else your program wouldn't even exist anyways). Kinda like making so somebody elses work was yours? – warkentien2 Jun 09 '16 at 13:19

1 Answers1

0

You can do this with an interactive rebase git rebase -i

Remove the commits you want to remove and keep the rest. You can also opt to squash commits by changing the pick keyword to squash.

You can find more information here: https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History

miva2
  • 2,111
  • 25
  • 34