5

I have cloned an SVN repository into a Git repository, and I just want the last commits beginning from f3a5b2a commit. I do want to retain the changes, but they can be part of that f3a5b2a commit, I want to get rid of the unnecessary history because I don't need it anymore and I have the old SVN repository backed up.

There are commits spanning across 7 years, I just want the commits beginning from f3a5b2a.

Moacir Rosa
  • 146
  • 2
  • 9
Tower
  • 98,741
  • 129
  • 357
  • 507
  • I had asked a similar question sometime back - http://stackoverflow.com/questions/495345/git-removing-selected-commit-log-entries-for-a-repository - The command you are probably looking for is `$ git rebase` – xk0der Aug 09 '12 at 09:47
  • @xk0der I read that question, but it relies on interactive mode and there's no way I'm going to do that. There must be some other way. – Tower Aug 09 '12 at 09:51
  • Look at some of the answers below the one I accepted - specially the `--onto` switch seems to be what should help you. (1) http://stackoverflow.com/a/495526/29096 (2) http://stackoverflow.com/a/3705152/29096 - and a couple more in the thread. – xk0der Aug 09 '12 at 09:53
  • Ah! I guess `--onto` removes stuff - This answer http://stackoverflow.com/a/495526/29096 seems more appropriate for your need. Without having to go through the interactive mode. – xk0der Aug 09 '12 at 09:55

1 Answers1

7

I found a better way to clone an SVN repository and dropping older commits:

git svn clone -r1234:HEAD https://asdasd/ targetPath

It basically clones the given SVN repository, starting from revision 1234 until it hits the head.

Tower
  • 98,741
  • 129
  • 357
  • 507