Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: Git Questions

From: Matthieu Moy <hidden>
Date: 2016-06-15 22:43:30

Tom Schinckel [off-list ref] writes:
The reason I want to do that is so I can set up blind commits that I can
add in a anacron job or something. The information about the files isn't
really important

Thanks for the help: I'm using git in a uncoventional way. 
OK. AAUI, you're abusing git as a backup system.

That's definitely not what git (and other VCS) is meant for. What git
is good at is to create clean "changesets" (i.e. _you_ tell git when
you have something worth recording in history), and merging. But since
git is fast and disk-efficient (if you run git-gc from time to time),
it can probably be a good backup tool too.

If you want to run "git commit" each time you save a file, you can
probably program your editor to do so, or use something like
fam/inotify. But it's probably not reasonable, you'll quickly end-up
with thousands of file revisions (imagine the result if you run a
script like "for i in $(whatever big thing); do echo $i >> file; done").
If I were you, I'd set up a cron job to do the commit once every (few)
minute(s). If the project is not too big, it will take less than a
second, and commit will fail silently if you have no modification to
commit.

You'll want git to automatically add any new file, so you'll run
something like

git add .

# Remove deleted files.
# There's probably a better way, but I don't find it.
git-ls-files --deleted -z | git-update-index --remove -z --stdin

git commit -m backup


I don't think your idea of taking the output of git-status as a commit
message is necessarily relevant: this information is anyway in the
commit, git-show and friends will show it. I'd say the commit message
is irrelevant, and you can provide a dummy one. Otherwise, someone
answered in the thread.

-- 
Matthieu
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help