A clean Git history is beneficial to a project in many ways. Similar to how clean code documents the current state of the software, a well-tended Git log documents what changes happened and why. For example,
- What are the design decision in a pull request?
- What has happened since the last fetch?
- Why did the implementation of a function change?
- Was this a refactoring or a change in functionality?
- When did the bug got introduced? (supported by git-bisect)
However, good commit messages are not enough for a clean Git history, and we need tend to and refactor our history before we "commit" to it; or in other words, rewrite the history. For all the questions above, we want to have coherent, small, and working commits. Further, a linear history helps to comprehend the sequence of changes more easily.
To visualize this, we want to go from this kind of Git log (here, only 3 developers worked in parallel)
to this kind of linear history (here, 5 developers worked in parallel)
or even as linear as OneFlow.
Note: This kata assumes that you are already have basic Git knowledge, like how to stage files, commit changes, push to origin, fetch and pull from remote, branching, and work with the Git log.
- Ensure the latest
Git
is installed and available in the shell - Navigate to the folder of an exercise; e.g.,
<kata-root>/101-local-amend-commit
- Run the
./init.sh
in that folder - Navigate to the created/updated folder
<kata-root>/exercise
with your favorite Git client - Consult the README.md in that folder for the description and task
This is optional, if you want to have compiler support of IntelliJ and/or use its integrated Git client.
- Open this Gradle project with IntelliJ
- You can use the free Community Edition
- On Windows, set
Settings > Tools > Terminal > Shell path
to"<system-path-to-git>\bin\bash.exe" --login -i
(see Note)
- In the project view, right-click the
init.sh
of an exercise and run it withRun 'init.sh'
- Select the created/updated folder
<kata-root>/exercise
and open theGit
tool window (ALT+9
)- If you cloned this repository, in the Git Log window, chose the filter
Paths: exercise
- If you cloned this repository, in the Git Log window, chose the filter
- Consult the README.md in that folder for the description and task
The init scripts for this kata are bash scripts, at the moment. Thus, you need a Bash to execute them. Fortunately for Windows, the Git Bash is a shell that can execute those scripts.
The Git version control system
- Atlassian learn Git
- Git Happens - Jessica Kerr
- Git Fu Developing - Sebastian Feldmann
- How Effective Teams Use Git - Enrico Campidoglio
- Learn Git Branching
- Git-Plugin of JetBrains IDEs (free with community edition IDEs)
- SmartGit (free/paid)
- Fork (paid)
- GitKraken (free/paid)