I've set up an experimental branch in git, but I'm trying out a few different implementations of a feature, using different libraries. I'd like to keep a record of these, as my own documentation of that approach/library. My pre-git instinct is to comment out the previous experiment --- but what's the best way to handle multiple experiments in git (or version control generally)?
EDIT I should clarify these will often be little bits of code (really, parts of features), perhaps only 3-10 lines long. For example, using getenv("HOME")
vs. wordexp
on ~
; using strcpy
vs. memcpy
. So there could be a lot of them, for alternatives on each step of even a relatively simple feature.
As a first stab, I've made a different branch for each version - but that will get unmanageable fast.
My current guess is:
- implement the first experiment
- commit it
- delete the first experiment
- implement the second experiment
- commit it
Then I can just look at the log to find the particular experiment. EDIT log entry will then be commented and dated.
(Actually I'd probably like to instead comment out the first experiment while working on the second one, so I can refer to it easily - then delete it just before committing the second one).
Is that a good workflow? Is there a better/standard approach? Many thanks for sharing your experience!