Skip to content

Instantly share code, notes, and snippets.

@betatim
Last active August 29, 2015 14:27
Show Gist options
  • Save betatim/18f852d243341df2d616 to your computer and use it in GitHub Desktop.
Save betatim/18f852d243341df2d616 to your computer and use it in GitHub Desktop.
# Assume you have a git repo that contains some code
# you would like to use the same repo to create snapshots
# of how exactly the repo looked at certain moments in
# time. For example every time you run `amazing_script.py`
# You want to capture all the things, not just files already
# part of the repo, you don't care about conflicts, just
# take a picture of the directory as it was right at that
# moment.
#
# Is this a good way of doing this?
#
# We created an extra branch called `logbook` to use as
# our logbook.
# run your script, which might or might not have
# uncommited changes, might or might not create several files
# that used to exist or not.
./amazing_script.sh
# to record the state of play run this (assuming you were on master)
git stash -u
git checkout log
git stash apply
# recurses into subdirectories??
git add *
git commit -m "A logbook entry"
git checkout master
git stash pop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment