Monday, May 21, 2012

GRWebDev :- Git 101 / Git-SVN Presentation

Just completed a presentation at Grand Rapids Web Developer tech group.  What an awesome group of folks.  I have pushed my presentation to Github.

Thanks
Carlus

Wednesday, May 9, 2012

Creating Git Patches for the Git-less

Recently, I have had to flex my git skills in a way that I have never had to do before.  I work for a client that does not use Git as their version control system of choice.  They use a product that starts with an 'S' and ends with a 'VN'.

Problem Statement
At times, there is code that I need to enhance, however, I do not have write permissions to.  If we were using Git, I would simply clone the project, create a branch for the specific feature, and once the feature was completed, have them pull from me.  However, this is not possible if the other team members are using SVN.  So how do you solve this issue?

Create a patch
The way to solve this problem is by creating a patch.  This patch cannot be just any patch, it has to be a patch that does not include all of the "Git" information.  Instead it is a patch that could be applied by using non-git tools.  Here are the instructions for creating such a patch:

1.)  Make sure you are on the feature branch where you just added your new feature.  For our purposes, we will say that it is feature_123.
2.)  This feature branch, let's say was created from the master branch.
3.)  In order to create a non-git friendly patch, you would enter the following command:  git diff --no-prefix master > feature_123.patch
4.)  You would then send this patch to someone that does have commit access to the repository.
5.)  They would apply the patch using their Editor of choice, or from the command line enter: patch -p0 < feature_123.patch


Happy Coding.