Last update: July 2025.
The current version of the tutorial is available here.
There are three branches:
codethat contains the Python code of the toy libraryneuroplot, that we use here for the tutorial. There is nothing related to documentation here.docthat contains the checkpoints of the tutorial.mainthat contains the final result of the tutorial, as well as the tutorial itself (indocs/tutorial).
Three key points:
maincontainsdocthat containscode. Never mergemainindoc, anddocincode.- As
doccontains the checkpoints in a sequential way, commit history is essential indoc. When you make changes to this branch, take care to preserve the story as much as possible. - In the tutorial, we refer to checkpoints via commit hashes of the
docbranch. So, if you change the history ofdoc, you must update the hashes in the tutorial (docs/tutorialonmain).
Just make the changes in the relevant page in docs/tutorial, and push on main.
- Do the step on
docto add a new checkpoint corresponding to this step. - Merge
docinmain. It will update the final result of the tutorial, that now takes into account the new step. - Update
docs/tutorialonmainto add a page describing the new step. Then, don't forget to mention your new page in aindex.rstpage (e.g.docs/tutorial/index.rst) to make your page appear in the Table of Content and the navigation bar. - Push
docandmain. Here you don't change the history, so a simplegit pull+git pushis enough.
- Make your changes on
code, then rebasedoconcode. The history of code will then be rewritten, taking into account the modifications made on the initial code. - Use
git push --forceto also rewrite the history oforigin/doc. - Then, merge
docinmain. - Update the commit hashes in the tutorial (
docs/tutorialonmain). This is necessary, because history ofdocwas rewritten. - Push
mainandcode(here a simplegit pull+git pushis enough).
Try not to, but if you really need to modify an old checkpoint on doc:
- Start an interactive rebase with
git rebase -i <commit-hash-to-your-checkpoint>. - In the editor, change "pick" to "edit" for the commit you want to modify.
- Make your modifications, and commit.
git rebase --continueto continue the rebase (if there are conflicts with the following commits).- Once the rebase is done,
git push --forcethedocbranch to also rewrite the history oforigin/doc. - Merge
docinmain, andpushmain.
main should contain the result of the tutorial, and doc contains the last checkpoint of the tutorial.
So doc and main should be very close. The only differences should be in docs/tutorial and docs/index.rst.
To make sure that they have not diverged, use: git diff --name-only main doc