Skip to content

Commit

Permalink
Update from original (#1)
Browse files Browse the repository at this point in the history
* Fix typos

* Remove usage of patch mode add from 3-way-merge exercise

Patch mode add is an advanced topic that does not fit the level of this
exercise and the time and way it is typically used in training.

* Add a bare minimum shell survival guide for training

* Add more editor config options to basic-commits

Instructions for Atom and Notepad++

* Fixed commit -m example

* Remove --decorate from katas

The --decorate option is default in git log, and provides no value in
the form where it is currently used in the examples.

* Mention `touch` to create an empty file

* Update SHELL-BASICS.md

Added elaboration

* Fix a typo: append missing closing brace

* Style: mark 'file.txt' as code

* Fix typos

* Adding note about running sh in windows
FIX  eficode-academy#183

* Mark "git status" as code

* Add learning path to README

Close eficode-academy#185 close eficode-academy#130 close eficode-academy#56

* setup.sh and verify.sh should be executables

* Fixed numbering, so that it now increments both in shell and in markdown

* Added atom and vscode to config examples

* Add simple way of setting up fake remote for exercises

* Change reorder-the-history exercise to use a remote

This allows `git rebase -i` to automatically go back
to origin/master if no target tree'ish is specified.

* Change fake remote script to create bare repo

Clean up new util shell scripts to separate files

* Fixed a typo in reorder-the-history/README.md

* Tweaked markdown in configure-git katas a bit.

* Added .gitattributes to make line endings consistent.

There was a mixture of both DOS and UNIX line endings in the files. The .gitattributes
file can serve as an example.

* Added more explanatory text to basic-commits/README

* Added exercise about excluding something from .gitignore

* Introduction to github

* Added exec-flag to setup.sh script, and fixed syntax error with shebang.

* Set theme jekyll-theme-midnight

* Use makerepo function

* Added to Merge Mergesort README

Added to the task and to the relevant commands

* Added useful commands section to amend/README.

* Added to the task in reorder-the-history/README.

Also added to useful commands.

* Add clone step to README Gif

* Added useful commands and more to reset/README

Added useful commands section and a further explanation section.

* Added the task section to bad-commit/README.md

Added a detailed the task section and added to useful commands.

* Added The task to commit-on-wrong-branch/README.md

Also added Useful commands

* Added to The task in merge-conflict/README.md

Added detailed steps to The tasks and updated the Relevant commands

* Added to The task in reverted-merge/README.md

Added detail to The task and added to Useful commands.

* Added The task in save-my-commit/README.md

Updated the README to be more similar to others.
Made The task slightly clearer and added some hints (via googling)

* Added to the task detached-head/README.

* Made The task more standard and added some detail.
* Added useful commands.

* Changed "git" to "Git" in detached-head/README

* Update README.md

Fix a typo

* Added kata about git tags.

* Improved squashing/README.md

* Made section names more consistent with other READMEs
* How to clean up the \n's wasn't clear so made it it own step and
added to Useful commands
* Added Further information on how to write Git commit messages
* Left in question on git rev-parse. Why this is useful should be made
clearer or the command deleted.

* Removed reference to 'git rev-pars'

* Minor improvements to submodules/README.md

* Made more standard.
* Added some explanatory text about why steps are being done.
* Replaced reference to `git submodule status` with
  `git submodule foreach 'git status'`, because it isn't obvious what the
  output of `git submodule status` means
* Not sure why we are making a second clone so put a TBD.

* Fix link in squashing-README

* Simplify `git lol` alias

`--oneline` is is a shorthand for `--pretty=oneline --abbrev-commit`, see git-log(1)

* Added kata for .gitattributes

* Mention `less` in SHELL-BASICS.md

Helpful alternative to `cat` for long files.

* Word ordering

* Add missing shebang in squashing/setup.sh

`setup.sh` should be executable according to the instructions given in README.md

* fix: wording

* Reordered katas on Overiew and added missing ones

Also grouped into sections in a suggested order.

* Added pointer to Overview also as Learning Path

With change to Overview file, it also contains a learning path.

* Use explicit numbering

* Expand  on  submodules kata

* Fix three typos

* Fix typos in submodule README

* Add kata Rebase Interactive with autosquash

* Clean up unused trainer-notes.md

* Update README.md

`git show <commit id>` was very helpful to me when I did this kata & and later on the job

* Updating git cheatsheet

* clarified pull-request comments

* correction to wrong description of 'git reset'

* clearing the description to be precise

* changed how shell script could be sourced in katas

* Set local git user name and email after initializing exercise repo (to distinguish commits).

* updating a email address to look like one.

* chaning email address to suggested

* helper functions to set and unset local user for training bot commits. Updated setup.sh instructions in few katas to take new effect in place.

* unset error option at the end

* advanced-rebase-interactive README: be consistent with cmdline args

Use `--interactive` as in previous step.

* configure-git README.md: mention private SSH key file

Mention files corresponding to public/private key.

* Simplify basic revert

close eficode-academy#177

* Elaborate and bugfix on rebase-exec

close eficode-academy#187

* use local remote for prepush kata

* Elaborate save my commit

* Small typos in ignore kata README

* Add master based workflow kata

* Fix wording in new exercise description

* Add fake author in master-based-workflow exercise

To easily distinguish own commits from the "virtual" collaborator's
ones.

* Fleshed out section one of config-git.md

* Fixed language and content for config-git

* Consistently use dashes in utils function names

Fix eficode-academy#248

* Add +x rights to pre-push setup.sh

* [Master Workflow] Fix Autor typo

* Consistently write 'Git' if talking about the tool

- Use 'Git' for the tool name
- Use 'git' as the command

* First try to rework "Configure Git" kata

- Start with installation, mention to open Git Bash one time for
  further cfg. steps
- Sub-chapter about SSH authentication

* Prevent weird errors when running setup.sh using e.g. bash setup-sh instead of source setup.sh

* Fix setup scripts of `submodule` kata

- Use parts of the infrastructure in `../utils/`
- Sourcing (`. setup.sh`) or executing (`./setup.sh`) the script now both works
- Don't try to be smarter than the average setup.sh script if it doesn't work anyway...

* Create GitHub actions CI pipeline for running test scripts (eficode-academy#265)

* Create CI pipeline running test scripts

* Fix CI definition

* Add execute access to test.sh

* Fix CI definition

* Make test.ps1 go through all exercises

* Add git user for submodules kata

* Add git user for submodules kata

* Fix setup.ps1 for submodules kata

* Add MacOS to GitHub actions jobs

* Create setup and verify scripts for bisect kata

Resolves: eficode-academy#164

* Create setup script for merge-driver kata

Resolves: eficode-academy#164

* Add file ending new lines

* Add setup.ps1 for git-attributes kata

Related issue: eficode-academy#261

* Add setup.ps1 for git-tag kata

Related issue: eficode-academy#261

* Add setup.ps1 for master-based-workflow kata

Related issue: eficode-academy#261

* Update README.md for git-attributes and git-tag

Add `setup.ps1` to the README.md files.

* Add setup.ps1 for pre-push kata

* Add setup.ps1 and verify.ps1 for rebase-exec kata

Related issue: eficode-academy#261

* Update README.md for bisect and merge-driver

* Gracefully fail when removing exercises folder

If for whatever reason the `exercises` folder cannot be removed the
`setup.ps1` script did not stop but continue running potentionally
spilling a lot of error messages.
With this change the failing deletion will stop the setup script.

Resolves: eficode-academy#243

* Further improve error handling in setup.ps1

Resolves: eficode-academy#243

* FIX problem that kills shell if not bash (eficode-academy#268)

Co-authored-by: Jan Krag <[email protected]>

* adding Dockerfile with zsh for regression test

* Complete zsh test

* Fix errors in actions CI file

* added explanatory text to ffmerge README

* Update README.md

* Disable GPG signing of commits locally during setup

As signing might be enabled globally, commits from setup scripts local user
should happen without signing.

* Add VS Code as a suggested editor

* Create change author kata

With this kata you can practice what does it take to change the authors
of already committed and pushed commits.
The idea sprang from a personal experience.

* Fix PR review findings

* Add commands that show contents of commits to better illustrate amending via adding a new file.

* Add an explanation for commands to run with amend.

* Final proposal for subtree git-katas

Co-authored-by: Mads Jensen <[email protected]>

* Add publish workflow

This is a precursor to our upcoming release pipeline, where the katas are made accessible without cloning them down, causing the dreaded nested git repo confusion.

* Change archive publising to a GH Release

* Fix indentation issue in publish.yml

* Fix tag in release asset name

Co-authored-by: Katrin Leinweber <[email protected]>
Co-authored-by: Johan Sigfred Abildskov <[email protected]>
Co-authored-by: Jan Krag <[email protected]>
Co-authored-by: Frank Theile <[email protected]>
Co-authored-by: Adam Matan <[email protected]>
Co-authored-by: Thanh-Nhon NGUYEN <[email protected]>
Co-authored-by: Sofus Albertsen <[email protected]>
Co-authored-by: Adam Matan <[email protected]>
Co-authored-by: kvartborg <[email protected]>
Co-authored-by: Victor Gram Thomsen <[email protected]>
Co-authored-by: Jan Krag <[email protected]>
Co-authored-by: Mads Jensen <[email protected]>
Co-authored-by: Brent Clark <[email protected]>
Co-authored-by: Natasha2001 <[email protected]>
Co-authored-by: Alex Blanc <[email protected]>
Co-authored-by: Frank Theile <[email protected]>
Co-authored-by: Fuchen Shi <[email protected]>
Co-authored-by: Michael Ingeman-Nielsen <[email protected]>
Co-authored-by: Sudheer Kumar Chiluveri <[email protected]>
Co-authored-by: Sofus Albertsen <[email protected]>
Co-authored-by: git-katas trainer bot <[email protected]>
Co-authored-by: Thierry Lacour <[email protected]>
Co-authored-by: Niels Kristian Jensen @ MAN <[email protected]>
Co-authored-by: bothzoli <[email protected]>
Co-authored-by: Christoffer Nissen <[email protected]>
Co-authored-by: Joachim Bülow <[email protected]>
Co-authored-by: Dan Grøndahl Glavind <[email protected]>
Co-authored-by: Thierry Lacour <[email protected]>
Co-authored-by: EfiGaja <[email protected]>
Co-authored-by: Claus Schneider (Praqma) <[email protected]>
Co-authored-by: Mads Jensen <[email protected]>
  • Loading branch information
32 people authored Oct 7, 2020
1 parent 4a05068 commit c0630aa
Show file tree
Hide file tree
Showing 111 changed files with 2,011 additions and 673 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
8 changes: 8 additions & 0 deletions .github/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM ubuntu:latest
RUN apt update -y
RUN apt install zsh git -y
COPY . /tmp/git-katas
WORKDIR /tmp/git-katas
ENV SHELL /bin/zsh
ENTRYPOINT [ "zsh" ,"-c" ]
CMD ["source testzsh.sh"]
42 changes: 42 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Publish

on:
push:
tags:
- '*'

jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Get tag
id: get_tag
run: echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//}

- name: Archive katas
shell: bash
run: git archive --output=git-katas.zip HEAD

- name: Create GitHub release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Attach katas
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./git-katas.zip
asset_name: git-katas-${{ steps.get_tag.outputs.TAG }}.zip
asset_content_type: application/zip
53 changes: 53 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
setup-bash:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Run bash test scripts
shell: bash
run: |
chmod +x ./test.sh
./test.sh
setup-bash-macos:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2

- name: Run bash test scripts
shell: bash
run: |
chmod +x ./test.sh
./test.sh
setup-pwsh:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Run PowerShell Core test scripts
run: ./test.ps1
shell: pwsh

setup-zsh:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Build Zsh image
run: docker build -t zshell -f .github/Dockerfile .
- name: running zsh test
run: docker run zshell
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*~
*.swp
**/exercise
git_attributes
*~
*.swp
**/exercise
**/remote
23 changes: 10 additions & 13 deletions 3-way-merge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,21 @@

## Setup

1. Run `. setup.sh` (or `.\setup.ps1` in PowerShell)
1. Run `source setup.sh` (or `.\setup.ps1` in PowerShell)

## The task
You again live in your own branch, this time we will be doing a bit of juggling with branches, to show how lightweight branches are in git.

1. Create a branch called greeting and check it out
1. Edit the greeting.txt to contain your favorite greeting
1. Add greeting.txt files to staging area using patch mode (`-p`)
1. Commit
1. Switch back to the master branch
1. Create a file README.md with information about this repository
1. Try adding README.md file to staging area using patch mode (it wont work)
1. What is the output of `git status`?
1. Add the README.md file to staging area and make the commit
1. What is the output of `git log --oneline --graph --all`?
1. Diff the branches
1. Merge the greeting branch into master
2. Edit the greeting.txt to contain your favorite greeting
3. Add greeting.txt files to the staging area
4. Commit
5. Switch back to the master branch
6. Create a file README.md with information about this repository
7. Add the README.md file to staging area and make the commit
8. What is the output of `git log --oneline --graph --all`?
9. Diff the branches
10. Merge the greeting branch into master

## Useful commands
- `git branch`
Expand All @@ -28,7 +26,6 @@ You again live in your own branch, this time we will be doing a bit of juggling
- `git checkout -b <branch-name>`
- `git branch -v`
- `git add`
- `git add -p`
- `git commit`
- `git commit -m`
- `git merge <branchA> <branchB>`
Expand Down
2 changes: 1 addition & 1 deletion 3-way-merge/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
source ../utils/utils.sh

kata="3-way-merge"
makerepo
make-exercise-repo

touch greeting.txt
git add greeting.txt
Expand Down
119 changes: 46 additions & 73 deletions Overview.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,46 @@
# Overview of Git Katas


## [Bad-commit](bad-commit/README.md)
Cleaning up a bit.

## [basic-commits](basic-commits/README.md)
Very basic creation of commits.

## [basic-staging](basic-staging/README.md)
interacting with the stage (index).

## [basic-branching](basic-branching/README.md)
The first stride into branching.

## [basic-cleaning](basic-cleaning/README.md)
Cleaning the workspace.

## [ignore](ignore/README.md)
The basics of using the `.gitignore` file.

## [commit-on-wrong-branch](commit-on-wrong-branch/README.md)
An administrative exercise, how do we _move_ a commit that we accidentially put on the wrong branch.

## [commit-on-wrong-branch-2](commit-on-wrong-branch-2/README.md)
Another exercise on what to do if you have accidentially committed
on the wrong branch.

## [ff-merge](ff-merge/README.md)
A tour around the most trivial of merges.

## [3-way-merge](3-way-merge/README.md)
A basic merge, involving multiple diverged branches.

## [merge-conflict](merge-conflict/README.md)
A basic merge between diverging branches with incompatible changesets.

## [merge-mergesort](merge-mergesort/README.md)
A merge confligt with actual code.

## [reverted-merge](reverted-merge/README.md)
A merge has to be reverted, but this causes problems.

## [rebase-branch](rebase-branch/README.md)
Using rebase as an alternative to merging.

## [pre-push](pre-push/README.md)
A quick exercise in using Git hooks.

## [reorder-the-history](reorder-the-history/README.md)
We might have created our commits in a suboptimal order, practice to fix that scenario here.

## [reset](reset/README.md)
Reset is a powerful and slightly dangerous command if you do not know what you are doing.
Go trough the three modes of resetting here.

## [basic-stashing](basic-stashing/README.md)
The first stride into stashing.

## [save-my-commit](save-my-commit/README.md)
Should you accidentially or on purpose delete a commit, go here to try and save it.

## [squashing](squashing/README.md)
A lot of small commits is good when you are working locally, but for sharing your code, it might be more beneficial to deliver your code changes in large sets. Go here to experiment with that.

## [submodules](submodules/README.md)
Submodules are loathed by many. Run through this exercise to see what the ruckus is all about.

## [Investigation](investigation/README.md)
Discover what is going on in a Git repo, figure out what it looks like under the hood.

## [Objects](objects/README.md)
A small exercise into Git internals.
# Overview of the Git Kata Exercises

## Setup

1. [configure-git](configure-git/README.md) - If git is not configured, some basic configuration steps

## Basic Git Katas in Suggested Order

1. [basic-commits](basic-commits/README.md) - Very basic creation of commits.
2. [basic-staging](basic-staging/README.md) - Interacting with the stage (index).
3. [basic-branching](basic-branching/README.md) - The first stride into branching.
4. [ff-merge](ff-merge/README.md) - A tour around the most trivial of merges.
5. [3-way-merge](3-way-merge/README.md) - A basic merge, involving multiple diverged branches.
6. [merge-conflict](merge-conflict/README.md) - A basic merge between diverging branches with incompatible (but simple) changesets.
7. [merge-mergesort](merge-mergesort/README.md) - A merge conflict with actual code.
8. [rebase-branch](rebase-branch/README.md) - Using rebase as an alternative to merging.
9. [basic-revert](basic-revert/README.md) - Use revert to revert a change
10. [reset](reset/README.md) - Reset is a powerful and slightly dangerous command if you do not know what you are doing. Go through the three modes of resetting here.
11. [basic-cleaning](basic-cleaning/README.md) - Cleaning the workspace.
12. [amend](amend/README.md) - Amending previous commits.
13. [reorder-the-history](reorder-the-history/README.md) - We might have created our commits in a suboptimal order, practice to fix that scenario here.
14. [squashing](squashing/README.md) - A lot of small commits is good when you are working locally, but for sharing your code, it might be more beneficial to deliver your code changes in large sets. Go here to experiment with that. Write a good commit
15. [advanced-rebase-interactive](advanced-rebase-interactive/README.md) - Practice using the interactive rebase commands.
16. [basic-stashing](basic-stashing/README.md) - The first stride into stashing.
17. [ignore](ignore/README.md) - The basics of using the `.gitignore` file. And using `git rm`.
18. [submodules](submodules/README.md) - Submodules are loathed by many. Run through this exercise to see what the ruckus is all about.
19. [git-tag](git-tag//README.md) - Tags are convenient for keeping track of commits that bump a version number. In this exercise, you will list, add and delete tags.

## Katas that solve standard problems

1. [commit-on-wrong-branch](commit-on-wrong-branch/README.md) - If we accidentally put unpushed commits on the wrong branch, how do we effectively _move_ them to another branch before our work on that branch.
2. [commit-on-wrong-branch-2](commit-on-wrong-branch-2/README.md) - Another exercise on what to do if you have accidentally committed on the wrong branch.
3. [reverted-merge](reverted-merge/README.md) - We revert a merge, but, after fixes are added to the merged branch, we want the changes from merge and the new fixes.
4. [save-my-commit](save-my-commit/README.md) - Should you accidentally or on purpose delete a commit, go here to try and save it. You will use the reflog.
5. [detached-head](detached-head/README.md) - git complains that you are in a "You are in 'detached HEAD' state". What do you do?

## Katas On Advanced features

1. [git-attributes](git-attributes/README.md) - .gitattributes file allows you to specify how git handles files, such as line endings in text files or how to diff a binary file.
2. [Bad-commit](bad-commit/README.md) - Using `git bisect` to find a bad commit.
3. [bisect](bisect/README.md) - Another kata using `git bisect`.
4. [pre-push](pre-push/README.md) - A quick exercise in using Git hooks.
5. [Investigation](investigation/README.md) - Discover what is going on in a Git repo, figure out what it looks like under the hood.
6. [Objects](objects/README.md) - A small exercise into Git internals.
7. [merge-driver](merge-driver/README.md) - Defining a custom merge driver.
8. [rebase-exec](rebase-exec/README.md) - Run tests on every commit using `git rebase --exec`
Loading

0 comments on commit c0630aa

Please sign in to comment.