Information Technology Reference
In-Depth Information
Problem
You have noticed that when learning and practicing git, very often you need to create a
series of revisions. Very often the content of files is not important and can be neglected.
You want to simplify the task of creating this type of commit with the simple-com-
mit alias. When called:
$ git simple-commit lorem ipsum dolor
the alias should create the three revisions shown in Figure 3-9 . Every parameter should
be interpreted as a request to create a new revision storing one new file. The call:
$ git simple-commit abc
should create a revision with the comment abc . The revision should include one new
file abc.txt containing the text abc .
Solution
Open your .gitconfig file and at the end of the [alias] section type the aliases
shown in Listing 3-13 .
Listing 3-13. Aliases: git create-file and git simple-commit
[alias]
create-file = "!createFile() {
for name in \"$@\"; do
echo $name>$name.txt;
done;
}; createFile"
simple-commit = "!simpleCommit() {
for name in \"$@\"; do
git create-file \"$name\";
git snapshot $name;
done;
}; simpleCommit"
 
 
Search WWH ::




Custom Search