git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git Questions

From
Matthieu Moy <matthieu.moy@imag.fr>
Date
Aug 20, 2007, 12:53 UTC
Message-ID
<vpqlkc6nz8c.fsf@bauges.imag.fr>
In-Reply-To
<1187612156.11595.17.camel@tom-desktop>
Tom Schinckel <gunny01@gmail.com> writes:
Show 5 quoted lines
> 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
Previous: Jan HudecNext: David Tweed
Message 8 of 9 in “Git Questions”
  1. Tom SchinckelAug 20, 2007
  2. Jeff KingAug 20, 2007
  3. David KågedalAug 20, 2007
  4. Tom SchinckelAug 20, 2007
  5. Andy ParkinsAug 20, 2007
  6. David TweedAug 20, 2007
  7. Jan HudecAug 20, 2007
  8. Matthieu MoyAug 20, 2007
  9. David TweedAug 20, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.