This gist presents a methodology of working on a task on feature branch using a TODO file as a support.
Here is a possible scenario:
- Turn on verbose commits option:
git config --local commit.verbose true
. It's really awesome! - Take a task from your project management tool.
cd
to repo.- Checkout to a main branch on the repo:
git checkout master
. - Pull the most recent changes from origin:
git pull origin master
. - Create a feature branch:
git checkout -B my-awesome-feature
. - Create a text TODO file. It can be any text file, but the tasks has to start with four characters
[ ]
- preferably a markdown or xit file. Ideally the task you've picked should be supported with acceptance criteria - you can copy them here to keep track of what is expected to be done. Don't hesitate to add anything that you think of to make the task complete. - Add a path of a TODO file to your local git config:
git config --local todo.file <file_path>
. - Work on a branch. Commit frequently. Leave lengthy documentation of the changes you commit (even if it's only a hack/partial commit/work in progress/etc.). It's very usefull to keep the history changes and the trace of reasoning in commits to present full documentation after you've done a task. It is highly recommended to use fixup commits when you make changes to already existing part of your implementation. After all, the simple rebase will make a branch clean, readable, well structured and documented.
- Any
git commit
command that opens up an editor, allowing to edit a commit message, will show you as well your todo list from a file. The todo list can be updated in place during editing the commit message. The todo list will not be added to your commit message, unless you copy the parts of that todo list in the commit message section of theCOMMIT_EDITMSG
. - You can either keep the todo file in repo, commiting it during the process or you can exclude it by adding it's file path to
.git/info/exclude
. - After a commit message is save and a commit being created, the script will check whether the list is fully completed and suggests you some actions afterwards. Read them carefully.
This methodology will keep you focused on items you have defined or operate on during the process of task accomplishment.
The main goal of it is to establish a constant looking at, editing and verifying the todo list. In the result it will force you to keep track of what is to be done.