Join the DZone community and get the full member experience.Join For Free
I use Git for quite some time now. But all the time I used it only in private projects where you don’t have to deal with merges and stuff. But since I’m using it in a real project with multiple developers, I’m realy at awe with the power of Git. It is extremely flexible and I can do all kinds of stuff with it I couldn’t even think about with SVN.
As you learn very quickly when starting with Git, Git is very different from most Version Control Systems you might know. This means in order to use Git you have to learn a lot. And learning is best done, by doing whatever you want to learn. This brought up the idea of Git Katas.
Kata is a form of practice with its origins in the martial arts, but the term is also popular in the software development community. The idea is that you practice a task, throw away the result and do it again. Over and over again.
The great thing is: Git (and the public repository infrastructure of GitHub) are great for actually setting up such Katas for learning Git.
- The Katas assume you work with the console. Note that the Windows Git installation includes the Git Bash which allows you to run Unix Scripts which are part of the Katas on Windows as well.
- You clone the Git Kata repository to a local repository on your machine.
- You clone the repository again in a second directory. This is where you will work for the kata. Cloning twice has two important consequences: If you screw up your Kata you can simply remove the second directory and recreate it as a fresh clone. Secondly some Katas require you to push work results to the remote repository, which will be your first clone.
- Change directory into the second repository and checkout the Kata you want to do. Each Kata is a Git branch starting with kata_. So you can type git checkout kata_ in order to get a list of valid katas available.
- In the second repository you’ll find a startKata.sh script. Run it. It will do changes to your repository and print the task for this Kata on the console. The task is also included in a readme.txt file in the Kata branch.
- Happy Gitting.
KronekerDelta and I learned a lot about Git when creating the first Katas and I hope you will enjoy and learn when doing them.
If you know a little Git you are likely to know more then we do and the Katas aren’t really a challange for you. If this is the case, how about providing your own Kata? Just create an orphan branch. Setup a startKata.sh and a readme.txt and let me know about it by opening an issue or a comment below or an e-mail at jens at schauderhaft de. I’ll pull it and add it to the existing katas. Note that a pull request on github doesn’t seem to work with orphan branches.
Also any feedback is extremely welcome in the comments below, in your own blog posts with a trackback to this article, or in the GitHub issue system.
Published at DZone with permission of Jens Schauder, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.