Sat, 28 Mar 2009
Git Snapshots
In his excellent article Git from the bottom up (PDF warning)
John Wiegley writes on page 26 about using
git-stash(1)
as a way of snapshotting the work in proggress, e.g. from cron(8)
.
He suggest to do git-stash && git-stash apply
every hour or so.
It is a nice idea, but it has a problem:
It changes the data under your hands, and there is even a short
window of time (between the stash
and apply
),
when the local changes temporarily disappear from the working tree.
So during this window it is not possible to e.g. open the file with the
text editor and expect it to have the contents which has been written to it
just several seconds ago.
Can snapshotting be done in Git correctly? Something like "save a current working tree as a new unreferenced commit"? How do you make the snapshots of your work, my dear lazyweb?