Skip to content

Instantly share code, notes, and snippets.

@parzonka
Created December 3, 2012 18:38
Show Gist options
  • Save parzonka/4196975 to your computer and use it in GitHub Desktop.
Save parzonka/4196975 to your computer and use it in GitHub Desktop.
Clone git branch locally
#!/usr/bin/env bash
# usage:
# cd /directory/with/git/repo
# clonebranch <branchname>
# => branch is cloned to /directory/with/git/repo/../reponame-branchname
git clone -b $1 file://${PWD} ${PWD}/../${PWD##*/}-$1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment