I am using git svn
on my local machine to sync with a SVN repo.
Recently, someone in my team added some experimental stuff (he was trying to add some tags) to the SVN repo and deleted it later in the next commit. After this my git svn refuses to fetch. It just gets to a certain point and stays stuck there.
I would not want to fetch all that experimental stuff into my local machine anyway. So, I would like to ignore certain commits in the SVN repository. Is that possible with git svn
?
This retrieves all the changes from the SVN repository and applies them on top of your local commits in your current branch. This works like, you know, a rebase between two branches :) You can also use git svn fetch to retrieve the changes from the SVN repository but without applying them to your local branch.
No interaction between them. Just ignore the . git folder for SVN and the . svn folder for Git and you should be fine.
Many people prefer Git for version control for a few reasons: It's faster to commit. Because you commit to the central repository more often in SVN, network traffic slows everyone down. Whereas with Git, you're working mostly on your local repository and only committing to the central repository every so often.
Say commit 666
is the one we need to skip. The trick is to make git
fetch all of the commits other than 666. Thankfully, git-svn gives us the -r
argument.
First, update to the commit immediately before the commit to be skipped:
git svn fetch -r BASE:665
Then, update everything after the bad commit to the Subversion tip:
git svn fetch -r 667:HEAD
That should give you a repository with everything except the commit you wish to skip. You can skip multiple revisions if necessary, just repeat the above commands for whatever range(s) of commits you do want to keep.
Skipping revisions can go awry if you skip file changes that will be affected by later revisions (e.g., you skip a file change or creation, and that file changes later in a revision you do fetch).
That said, I've just done it to skip a revision where someone had copied the entire Subversion repository into the tags/
directory, then deleted the obviously invalid tag. I used the above trick to skip the revision where the invalid tag was created (Git had been trying to download the entire repository), let it fetch the deletion (which it just ignored), and all was right with the world.
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