A set of exercises for deliberate Git Practice
Clone or download
Permalink
Failed to load latest commit information.
3-way-merge Fix #138 Sanitize all READMEs wrt entering the exercise folder Nov 9, 2018
advanced-rebase-interactive Fix #138 Sanitize all READMEs wrt entering the exercise folder Nov 9, 2018
amend Fix #138 Sanitize all READMEs wrt entering the exercise folder Nov 9, 2018
bad-commit Fix #138 Sanitize all READMEs wrt entering the exercise folder Nov 9, 2018
basic-branching Fix #138 Sanitize all READMEs wrt entering the exercise folder Nov 9, 2018
basic-cleaning Fixed various spelling mistakes Nov 13, 2018
basic-commits Fix #138 Sanitize all READMEs wrt entering the exercise folder Nov 9, 2018
basic-revert Fixed various spelling mistakes Nov 13, 2018
basic-staging Fix #138 Sanitize all READMEs wrt entering the exercise folder Nov 9, 2018
basic-stashing Add PowerShell setup option to README.md files Oct 30, 2018
bisect Fixed various spelling mistakes Nov 13, 2018
commit-on-wrong-branch-2 Fix #138 Sanitize all READMEs wrt entering the exercise folder Nov 9, 2018
commit-on-wrong-branch Fix #138 Sanitize all READMEs wrt entering the exercise folder Nov 9, 2018
configure-git Added config info about configuring notepad++ Nov 13, 2018
detached-head Merge branch 'master' into 138-explicit-cd-in-instructions Nov 9, 2018
docs Set theme jekyll-theme-cayman Dec 26, 2017
ff-merge Fix #138 Sanitize all READMEs wrt entering the exercise folder Nov 9, 2018
ignore Fixed various spelling mistakes Nov 13, 2018
images close #98 Optimize quickstart gif size Jun 2, 2017
investigation Fixed various spelling mistakes Nov 13, 2018
merge-conflict Fix #138 Sanitize all READMEs wrt entering the exercise folder Nov 9, 2018
merge-driver Fix #138 Sanitize all READMEs wrt entering the exercise folder Nov 9, 2018
merge-mergesort Fix #138 Sanitize all READMEs wrt entering the exercise folder Nov 9, 2018
objects Consistent use of ordered lists in tasks Jan 20, 2017
pre-push modified: pre-push May 12, 2018
rebase-branch Fix #138 Sanitize all READMEs wrt entering the exercise folder Nov 9, 2018
rebase-exec Fix #138 Sanitize all READMEs wrt entering the exercise folder Nov 9, 2018
reorder-the-history Fix #138 Sanitize all READMEs wrt entering the exercise folder Nov 9, 2018
reset Fix #138 Sanitize all READMEs wrt entering the exercise folder Nov 9, 2018
reverted-merge Fix #138 Sanitize all READMEs wrt entering the exercise folder Nov 9, 2018
save-my-commit Fix #138 Sanitize all READMEs wrt entering the exercise folder Nov 9, 2018
squashing Fix #138 Sanitize all READMEs wrt entering the exercise folder Nov 9, 2018
submodules Fix #138 Sanitize all READMEs wrt entering the exercise folder Nov 9, 2018
utils Add Powershell setup files for basic katas Oct 26, 2018
.gitignore add .swp files to .gitignore Feb 8, 2017
LICENSE.txt Add license Feb 10, 2017
Overview.md Merge branch 'add-second-commit-on-wrong-branch' Aug 2, 2018
README.md Merge branch 'master' into master Nov 9, 2018
test.ps1 Add test powershell close #161 Nov 9, 2018
test.sh Add bash test script Nov 9, 2018
trainer-notes.md Create trainer-notes.md Dec 14, 2017

README.md

maintainer
randomsort

Git Katas

Quick Start

In the Cloud

Open in Cloud Shell

On Your Local Machine

Quick Start

  • Clone this repository
  • Go into the folder you want to solve an exercise in
  • Run the setup.sh script
  • Consult the README.md in that folder to get a description of the exercise

Purpose of Git Katas

This repository is a collection of Git exercises. The concept is stolen without shame from Schauderhaft.de. Unfortunately, they have not maintained the system - and we need more good Git exercises.

The exercises are designed for use when we are teaching Git courses. You should be able to use them as self-contained exercises that will allow you to keep your Git skills sharp.

Exercises starting with basic are entry-level - other exercises vary greatly in difficulty.

To get an overview of the exercises in here look in Overview.md.

Feel free to use these exercises, that's why they're public!

Contributing

If you miss exercises or find errors in any of them, feel free to improve them and make a pull request.

You can also make an issue so we notice an opportunity to improve!

Thank you!

Cheatsheet

A collection of useful commands to use throughout the exercises:

# Cloning a repository
git clone https://github.com/praqma-training/git-katas.git      # Clone this repository to your current working directory

# See local changes
git status                  # Show the working tree status
git diff                    # Show changes current working directory (not yet staged)
git diff --cached           # Show changes currently staged for commit

# Add files to staging (before a commit)
git add myfile.txt          # Add myfile.txt to stage
git add .                   # Add entire working directory to stage

# Make a commit
git commit                              # Make a new commit with the changes in your stage
git commit -m "I love documentation"    # Make a new commit with a commit message from the commandline
git commit -a                           # Make a new commit and automatically "add" changes from all known files
git commit -am "I still do!"            # A combination of the above
git commit --amend                      # Re-do the commit message of the previous commit (don't do this after pushing!)
                                        #   We _never_ change "public history"

# See history
git log             # Show commit logs
git log --oneline   # Formats commits to a single line (shorthand for --pretty=oneline)
git log --graph     # Show a graph commits and branches

# Working with Branches
git branch my-branch       # Create a new branch called my-branch
git checkout my-branch     # Checkout ("Switch" to work on) my-branch
git checkout -b my-branch  # Create a new branch called my-branch AND switch to it
git branch -d my-branch    # Delete branch my-branch that has been merged with master
git branch -D my-branch    # Forcefully delete a branch my-branch that hasn't been merged to master

# Merging
git merge master         # Merge your currently checked out branch with the master branch

# Working with Remotes
git remote              # Show your current remotes
git remote -v           # Show your current remotes and their URLs
git push                # Publish your commits to the upstream master of your currently checked out branch
git pull                # Pull changes from the remote to your currently checked out branch

# Aliases - it's possible to make aliases of frequently used commands
#   This is often done to make a command shorter, or to add default flags

# Adding a shorthand "co" for "checkout"
git config --global alias.co "checkout"
# Usage:
git co      # Does a "git checkout"

## Logging
git log --graph --decorate --pretty=oneline --abbrev-commit --all # Show a nice graph of the previous commits
## Adding an alias called "lol" (log oneline..) that shows the above
git config --global alias.lol "log --graph --decorate --pretty=oneline --abbrev-commit --all"
## Using the alias
git lol     # Does a "git log --graph --decorate --pretty=oneline --abbrev-commit --all"

Testing

There is a very small test that you can run in powershell or bash. It is contained in the scripts test.sh and test.ps1.