The last couple of weeks I worked a lot with NPanday which brings maven to .NET. But this post is not about NPanday but rather about the workflow for maintaining a personal branch and uploading patches.
I’m not a committer, but I had to do some changes to NPanday. I still want to version my changes. I also want to contribute patches, when I fix bugs that apply to the current trunk.
NPanday is hosted on Codeplex, and though accessible via the SvnBridge. So I chose to give git svn a try.
I also want to host my changes on github.
The Workflow
- Once
- Clone a svn repo to a local-git
- Create a branch for svn updates, say codeplex
- Create a GitHub repo and push both branches
- Repeatedly
- Do your work on master
- Commit and push your work
- Update codeplex from subversion and push it
- Merge codeplex to master
- Contribute and Commit
- How to create and submit patches from our master
- How to commit changes back to codeplex
The How-To
I don’t want to mess around with npanday, so I created a empty test-project on codeplex.: [SAMPLE PROJECT] Branch and Patch with GIT
Setup (Windows)
On mac you simply use mac ports, on linux I have no clue.
-
Install SVN binaries and add to %PATH% (download)
- The binary mysys doesn’t come with git svn anymore, so you have to compile it yourself. Is not as hard as it sounds. Just download the fullinstall – it will run the compile for you. (download 1.7.0.2 , downloads) Don’t forget to add it to the path, too.
I’ll do everything on the command line. Red is SVN, green is GIT – they are in separate folders.
I use pictures. Type it yourself! It will help you to learn it.
Don’t be afraid reading the command line either. It’s like code! You’ll get used to it, so did I.
Once
Checkout and commit a text file
Init and fetch the commited revision using svn git:
Now, since we want to do changes, lets create a branch codeplex but remain on master and do changes.
We should make sure, that the branch codeplex is untouched:
I also created a project on github. So lets push it over there. Read how to setup your private key and connect here.
Now we have the two commits on the master:

And only one on codeplex:

Now we change our “subversion”-file:
And then we update it using git svn rebase on the codeplex branch. Sorry for not having accepted the certificate before. But its live! 🙂
Result:

Now we want to have that change over on our work branch.

Voilá:

Now, this is our repo:
Enough for today. Let’s se what we covered:
Recap
- Once
- We initialized the empty codeplex repo with a single-line file.
- Clone a svn repo to a local-git
We used git svn init and fetch to get the codeplex contents in a local git repository.
- Create a branch for svn updates, say codeplex
We created the branch
- Create a GitHub repo and push both branches
We pushed both master and codeplex
- Repeatedly
- Do your work on master
We added a file to our master.
- Commit and push your work
We pushed it to master. Both the source svn and codeplex branch remain untouched.
- Update codeplex from subversion and push it
We added a line and checked it into svn and then we got it into our codeplex branch did that.
- Merge codeplex to master
We did that too.
More soon! Probably next Friday:
- Contribute and Commit
- How to create and submit patches from our master
- How to commit changes back to codeplex