Shortcut for cloning Drupal Git Repositories
Taken from a conversation on Groups.Drupal.org where several people shared some of their shortcuts for using git. The following Bash function will clone a git repository from git.Drupal.org, and optionally set up and switch to a remote tracking branch of the specified version.
function dclone() {
git clone git://git.drupal.org/project/$1.git
if [ -n "$2"]; then
cd $1
git checkout --track origin/$2
cd ..
fi
}
While the git-clone documentation specifies a --branch parameter, my server seems to have an older version of git which doesn't support it. Therefore, creating the specified tracking branch is compeleted in a separate command.

Comments
Post new comment