Shteing without changing the index or working tree

In Bottom Up's Git, John Wiegley suggests launching a cronjob during the day, which triggers a Git stash followed by a Git application. I appreciate the idea of ​​taking hourly (or even more frequent) snapshots of my work, but I'm afraid that the assembly may break if the file instantly disappears or reverts to HEAD. Is there any other way to achieve the goal without risking it?

+5
source share
2 answers

You can do something like:

git branch -f autosave $(git stash create)

This will cause the branch to autosavebe updated to the recently updated stash object. git stash createsaves but does not apply to your index and working tree. You can rely on reflog autosaveto find previous versions, as stash does.

+4
git update-ref refs/stash $(git stash create)

stash ( , ) .

()

0

All Articles