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
.
Luckily, you can process your files with Git and remove from commit and fix the history. If you've made several commits or cloned a repository with an already existing commit history, you'd typically want to look back and see what all commits were made.
It's cleanup time ⏰ If you have been lazily writing multiple vague commits, you can use git reset --soft <old-commit> to make your branch point to that old commit. And as we learned, Git will start by moving the branch pointer to it and stops right there.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With