git-transaction: Transaction support for git
git is not only for source code management. You could be tempted to keep some application data in a filesystem based "database" for several reasons. If you don't have large amounts of data and only rarely change this this offers some advantages: a) you don't need a server process; b) you can push around your data to scale horizontally. And then git can calculate differences between versions quite easily - a task that requires some heavy user code on traditional databases.
In that case you might want to have transactions, and "git-transaction" adds just that. It
- checks out a repository into a temporary area
- runs a command
- and commits and pushes back all changes if the command was successful.
Why would you do this?
How to install git-transaction
Installing is as easy as
Note that this calls the "git-transaction" script directy, while the regular use would be "git transaction".
git transaction [ -b basedir ] [ --readonly ] [ --no-symlinks ] [ -m message ] [ -v ] command ... Options are: --basedir, -b <s>: Create the temporary repository below this directory. (Default: $TMPDIR) --readonly, -r: Do not commit changes back into the repository. --message, -m: Commit message --verbose, -v: Be verbose --skip-mtimes, -s: Don't sync mtimes --debug, -D: Be more verbose --help, -h: Show this message
--basedir: Check out into a specific place
--basedir option allows you to determine where the temporary directory will reside. Especially
for larger repositories you might want to consider putting the temporary repository onto a RAM-disk.
--readonly: ignore changes
--readonly option prevents changes from being writing back into the repository.
--skip-mtimes: Don't sync mtimes
git does not set the mtimes of checked out files. As you might need the mtimes though,
git-transaction script sets the mtimes of all files to when they were last modified in the
repository. If you don't need this information you can prevent this via