If you have followed the instructions properly, any new remote SVN branch would be fetched by running the following command
But if your setup is different from the once mentioned in the earlier post then, continue reading ahead.
You are a cool developer/QA/BA (or simply a cool person), who uses GIT over SVN. Someone created a new SVN branch. You want to checkout this new SVN branch and do some commits on it. But wait! When you setup your GIT SVN repository this branch did not exist. Hence, GIT does not know anything about this new remote branch! How can you say,
Hey Mr. GIT, here is a new SVN branch. Could you please start tracking it for me?
How do they do it?
Actually, turns out, its very simple.
- Do some edit in the .git/config file
- Do a git svn fetch of the new remote branch
- Create a local branch pointing to the newly added remote branch
- Start hacking the code on the new branch!
The key here is only the first step. Without wasting anymore time lets dive into the solution.
Step - 1:
Open the "config" file in the .git directory in your favorite text editor.
Lets say that the new SVN branch is called "branch1". Its located at http://non-standard-repository.googlecode.com/svn/branches/module1/branch1
Add the following entries to the .git/config file
If you do not feel comfortable editing the .git/config file manually then use the following commands to achieve the same effect
Step - 2:
The setup is done. All we now need to do is execute the following command
This will get the version history from the "branch1" SVN branch into the local GIT repository. By now you should have a remote branch "branch1" created in your git repository
Step - 3:
Crete a local branch from the newly added remote branch is simpel enough
You are now all set to start hacking the code on the local_branch1!
Step - 4:
No explanations required here!
That's it! With GIT there are always multiple ways of solving any problem! Go GIT it!