I am working solo on small development projects on my own time, using Git. For each project, I like to have a development journal which is associated with that project and not associated with other projects. The journal is a simple markdown file, journal.md
.
Here are my requirements for managing the journal in my workflow:
there must be exactly one managed version of
journal.md
in the project repository; andI need to be able to make changes to
journal.md
from any branch, and keep those changes when checking out different branches viagit checkout
(i.e., the file must not change as a result of switching branches, and must not be deleted when switching branches).
I am looking for workflows (either a sequence of Git commands for switching branches, or a way of storing journal.md
, or something else which enables me to work normally in Git while satisfying the above requirements).
I have investigated the following options.
Keep a separate orphan branch
journal
; commit the initial journal, and journal updates, to this branch and no other branches. This satisfies the first requirement, but the second requirement is trickier due to the behavior ofgit checkout
.- Suppose I've finished the day and committed my journal updates to
journal
; then, when starting the next day, I need to switch fromjournal
tomaster
. In this situation,git checkout
will deletejournal.md
, even though I want to keep the file around and modify it. - Suppose I have a modified version of
journal.md
while onmaster
, and I want to commit this modified version tojournal
. In this situation,git checkout
will complain that "local changes will be overwritten". - I could avoid both of these issues if I could add/commit a single file to
journal
while onmaster
, without actually checking outmaster
. However, I have not found a way to do this.
- Suppose I've finished the day and committed my journal updates to
Keep a separate repository for the journal file for this particular project--e.g.,
<project>-journal
. This obviously doesn't satisfy the first requirement, although it does satisfy the second. The primary problem with this approach is that I have two separate repositories for a single (small) project. This feels...wrong.
Any suggestions would be appreciated.
journal
branch and then generate thejournal.md
from output ofgit log
for that branch.git notes
, e.g. keep the journal as a note on the root commit.