Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A set of exercises for deliberate Git Practice

License

NotificationsYou must be signed in to change notification settings

eficode-academy/git-katas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

maintainer
JKrag

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 thesetup.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 fromSchauderhaft.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 withbasic are entry-level - other exercises vary greatly in difficulty.

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

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

Suggested Learning Path

If you are coming to this repository for some basic Git knowledge, we recommend going through the exercises in the following order.This is the order that Jan Krag at Praqma teaches Git and might change over time. There are more exercises than this, but these should take you througheverything you need to be able to use Git effectively in your day to day life.

SeeOverview.md for a more complete list and suggested order.

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!

Celebrating success

On September 6th, 2023, we reached the milestone of having 1000 stars on GitHub. Thank you all for your support! This repository would not be where it is without the valuable contributions from the community.

1000 stars

Cheatsheet

A collection of useful commands to use throughout the exercises:

# Initializing an empty git repository.git init# Initialize an empty git repository under current directory.# Cloning a repositorygit clone https://github.com/praqma-training/git-katas.git# Clone this repository to your current working directory# Git (user and repo level) configurationsgit config --local user.name"Repo-level Username"# For setting a local git repo level user name.git config --local user.email"Repo-level.Email@Example.com"# For setting a local git repo level user email.# --global -> User level git config stored in <user-home>/.gitconfig for e.g. ~/.gitconfig# --local -> repo level config stored in repo's main dir under .git/config# See local changesgit status# Show the working tree statusgit 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 stagegit add.# Add entire working directory to stage# Make a commitgit commit# Make a new commit with the changes in your staging area. This will open an editor for a commit message.git commit -m"I love documentation"# Make a new commit with a commit message from the command linegit commit -a# Make a new commit and automatically "add" changes from all known filesgit commit -am"I still do!"# A combination of the abovegit commit --amend# Re-do the commit message of the previous commit (don't do this after pushing!)#   We _never_ change "public history"git reset<file># Unstage a staged file leaving in working directory without losing any changes.git reset --soft [commit_hash]# resets the current branch to <commit>. Does not touch the staging area or the working tree at all.# --hard mode would discard all changes.# Configuring a different editor## Avoid Vim but stay in terminal:-`git config --global core.editor nano`## For Windows:- Use Notepad:`git config --global core.editor notepad`- orfor instance Notepad++:`git config --global core.editor"'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"`# See historygit log# Show commit logsgit log --oneline# Formats commits to a single line (shorthand for --pretty=oneline  --abbrev-commit )git log --graph# Show a graph commits and branchesgit log --pretty=fuller# To see commit log details with author and committer details, if any different.git log --follow<file># List the history of a file beyond renamesgit log branch2..branch1# Show commits reachable from branch1 but not from branch2# Deferringgit stash# Stash (store temporarily) changes in working branch and enable checkingout a new branchgit stash list# List stored stashes.git stash apply<stash># Apply given <stash>, or if none given the latest from stash list.# Working with Branchesgit branch my-branch# Create a new branch called my-branchgit switch my-branch# Switch to a different branch to work on itgit switch -c my-branch# Create a new branch called my-branch AND switch to itgit branch -d my-branch# Delete branch my-branch that has been merged with mastergit branch -D my-branch# Forcefully delete a branch my-branch that hasn't been merged to master# Merginggit merge master# Merge the master branch into your currently checked out branch.git rebase master# Rebase current branch on top of master branch# Working with Remotesgit remote# Show your current remotesgit remote -v# Show your current remotes and their URLsgit push# Publish your commits to the upstream master of your currently checked out branchgit push -u origin my-branch# Push newly created branch to remote repo setting up to track remote branch from origin.# No need to specify remote branch name, for e.g., when doing a 'git pull' on that branch.git pull# Pull changes from the remote to your currently checked out branch# Re/moving files under version controlgit rm<path/to/the/file># remove file and stage the change to be committed.git mv<source/file><destination/file># move/rename file and stage the change to be committed.# 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 "sw" for "switch"git config --global alias.sw"switch"# Usage:git sw master# Does a "git switch master"## Logginggit log --graph --oneline --all# Show a nice graph of the previous commits## Adding an alias called "lol" (log oneline..) that shows the abovegit config --global alias.lol"log --graph --oneline --all"## Using the aliasgit lol# Does a "git log --graph --oneline --all"

Testing

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

Cleanup

You can remove testing artifacts,exercise directories, with the git clean command:

git clean -ffdX

About

A set of exercises for deliberate Git Practice

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors46


[8]ページ先頭

©2009-2025 Movatter.jp