Welcome to Git Kata - the place to train your Git Skills
What is a Kata?
Over the last years a training form from martial arts invaded software development: Katas.
The idea is that you take a combination of moves (or a simple programming problem) and do it over and over again until you can do it in your sleep. With Programming katas you delete your code after the kata.
You can, and I did use this for learning new languages, honing your IDE skills or explore various ways of solving a given problem.
What is a Git Kata?
The idea is simple: setup a problem as you might experience during Git usage, solve it using git. Repeat. This site does most of the setup part for you, so you can concentrate on solving the problem.
Why do we need Git Katas?
Git is extremely powerful when compared to other VCS you might have used before. It is flexible. You can do almost anything with it. Cool. But responsible developers tend to be careful (and rightly so) when experimenting with new features of their normal programming language. Although they have version control and can go back to a previous version at any time. But now we have a version control system that allows all kinds of cool stuff. Are you going to try that on your production repository? Are you lookin forward toward facing an especially tricky (i.e gitty) problem for the first time with your production repository shortly before the next release? If not Git Kata are a great way to hone you skills before you need them, in the relaxed environment of a sandbox.
How to do a Git Kata?
Technically a Git Kata is a branch in the Git Kata repository. In order to do the kata, you clone the repository:
git clone --mirror https://github.com/schauder/gitkata.git gitkata-upstream.git
Then you clone that repository once more. This allows you to actually push commits, which is part of some katas. We use gitkata-work as the directory for the new repository:
git clone gitkata-upstream.git gitkata-work
Next you change into the new directory and checkout the branch for the kata you want to do. All kata branches start with kata_. For example:
git checkout kata_on_the_wrong_branch
You'll find a shell script startKata.sh. Start that script. It will make changes to your workspace, possibly creating files, commits and branches. It will also print what you are supposed to do in the Kata. It will describe the aim that you are supposed to reach. It will NOT tell you how to reach that aim, that is one main part of the Kata.
The following katas are available:
- kata_on_the_wrong_branch The first kata. But not an easy one. Think rebase.
- kata_one_wrong_commit Get rid of a git commit.
- kata_pick_your_features Cherry-picking for beginners.
- kata_to_many_commits Squashing.