The Artima Developer Community
Sponsored Link

Java Buzz Forum
Use Git even if your team doesn’t: git-svn tips and tricks

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Mathias Bogaert

Posts: 618
Nickname: pathos
Registered: Aug, 2003

Mathias Bogaert is a senior software architect at Intrasoft mainly doing projects for the EC.
Use Git even if your team doesn’t: git-svn tips and tricks Posted: Dec 23, 2013 12:19 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Mathias Bogaert.
Original Post: Use Git even if your team doesn’t: git-svn tips and tricks
Feed Title: Scuttlebutt
Feed URL: http://feeds.feedburner.com/AtlassianDeveloperBlog
Feed Description: tech gossip by mathias
Latest Java Buzz Posts
Latest Java Buzz Posts by Mathias Bogaert
Latest Posts From Scuttlebutt

Advertisement

Before joining Atlassian, I’d been working on various projects that still used Subversion (SVN) as their version control system. I had moved to Git already years before, and I wanted to keep using it as much as possible. Luckily I could use git-svn: An incredibly complete solution to interact with Subversion repositories without leaving the comfort of the Git power toolset. But there are gotchas. This post assumes you are already a little bit acquainted with git-svn, and you know how to interact with a SVN repository using it. The list below contains all the tricks and tips I had to research and integrate in my workflow to keep using Git joyfully in conjunction with SVN. Enjoy! Easy SVN to Git migration guide! Setting up the files to ignore You should make sure that Git ignores the same files SVN does. The simplest trick is to append the list of svn:ignore files to the default git exclude file: 1git svn show-ignore >> .git/info/exclude An alternative method is the magical update-index: 1git update-index --assume-unchanged files to ignore This is quite a fine trick, and I’ve consistently used in the past year. If you need more information, have a look at this post on Stackoverflow. If you use the latter method, how do you find out later that a file has been ignored in Git? You can use this: 1git ls-files -v | grep ^[a-z] | sed -e 's/^h\ //' NOTE: update-index is an advanced command that manipulates the index directly, use it with care! Shallow clone big repositories I’ve worked with SVN codebases above 1.5Gb for a full checkout. In similar scenarios, checking out the entire history commit by commit – the way git-svn does – can be lengthy, as the repository is simply too big. The way around this issue is to create a shallow clone of the repository; instead of copying the entire history of the project you just copy the last n commits and proceed from there. For example: 1git svn clone -s -r604:HEAD http://nick@svn.xxxxxx.com/repos/ -T trunk -b branches -t tags Where “604“ must be replaced with the earlier revision you want to keep. Mandatory Stackoverflow reference. If you added the .svn folders by mistake in Git Sooner or later you’ll run into a few snags. For example one time I didn’t use git-svn, I just checked out a project from SVN but I wanted to do my own tracking using Git. At that time I mistakenly added the .svn folders to the index (staging area) in Git. How to keep those important files but remove them from the index?  Tricky! Here’s how to untrack files without actually deleting them in Git: 1git st | grep .svn | awk {'print $3'} | xargs git rm --cached The keyword here is –cached that operates on the index and not in the working directory. Very clearly explained in this chapter on progit. What to do when a SVN repository moves When a SVN repository moves (or when you have to access it via VPN and do some smart tunneling that will change its address) you have to follow the […]

The post Use Git even if your team doesn’t: git-svn tips and tricks appeared first on Atlassian Blogs.

Read: Use Git even if your team doesn’t: git-svn tips and tricks

Topic: Functional Groovy Previous Topic   Next Topic Topic: Using more than one property file in Spring MVC

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use