Information Technology Reference
In-Depth Information
config
file, save the file, and close the editor.
Listing 3-4.
Alias git snapshot
[alias]
snapshot = "!snapshot() {
COMMENT=wip;
if [ \"$*\" ]; then
COMMENT=\"$*\";
fi;
git add -A;
git commit -m \"$COMMENT\";
}; snapshot"
How It Works
Similar to Recipe 2-10, the alias was split with newlines. Remember that newlines are
here only to make the alias easier to read—you must type the alias as one long line in
your
.gitconfig
file.
The alias uses the shell function
snapshot
that after parsing of
.gitconfig
be-
comes:
snapshot() {
COMMENT=wip;
if [ "$*" ]; then
COMMENT="$*";
fi;
git add -A;
git commit -m "$COMMENT";
}
The instruction:
COMMENT=wip;