Information Technology Reference
In-Depth Information
defines a variable named
COMMENT
with the value
wip
. Wip is an abbreviation for
work in progress. The special variable
$*
contains all the parameters passed to the
script. Consider the command:
$ some-script a b c
This call sends to the script
some-script
three parameters:
a
,
b
, and
c
. You can
access all three parameters as one using the quoted
$*
variable
"$*"
.
The conditional statement if-then-fi:
if [ "$*" ]; then
COMMENT="$*";
fi;
checks the parameters passed to the script. If the script was called with parameters they
will be assigned to
COMMENT
variable. Otherwise the
COMMENT
variable will stay un-
changed—it stores the default value wip.
Now you know everything that will enable you to understand how the snapshot alias
works. When we run the command:
$ git snapshot
it creates a revision with comment wip.
If we pass any parameters:
$ git snapshot Lorem ipsum dolor
then the alias will create the revision with comment “Lorem ipsum dolor”.
3-3. Using the git snapshot alias in your
daily work
Problem