Information Technology Reference
In-Depth Information
Hint The alias $ git clone-with-branches is useful while learning git.
You will probably come to the same conclusion, by the end of this chapter or once we
start to practice merging and rebasing.
Creating git subcommands as shell scripts
The aliases you implemented in Recipe 2-10 and Recipe 5-3 were stored in your global
.gitconfig file. The main drawback of this method is that newlines are prohibited.
Every alias, no matter how complicated, has to be stored in a single line of a .git-
config file. This is an internal restriction imposed by .gitconfig parsing. You
can circumvent this restriction by storing your aliases as separate bash scripts. To pre-
pare the $ git clone-with-branches git subcommand using indented syntax,
create the file: 3
# on Windows
C:\Program Files
(x86)\Git\libexec\git-core\git-clone-with-branches
# on Linux
/usr/lib/git-core/git-clone-with-branches
with the contents shown in Listing 5-2 . You don't have to remove newline characters
while saving Listing 5-2 to a file.
Listing 5-2. Shell script git-core/git-clone-with-branches
#!/bin/sh
git clone $1 $2
cd $2
git checkout-remote-branches
git remote rm origin
 
 
 
Search WWH ::




Custom Search