citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

git-checkout-remote (289B)


      1 #!/usr/bin/env bash
      2 
      3 set -e
      4 
      5 usage() {
      6     printf "usage: git-checkout-remote <remote> <branch>\n"
      7     exit 1
      8 }
      9 
     10 REMOTE="$1"
     11 BRANCH="$2"
     12 
     13 if [ -z "$REMOTE" ] || [ -z "$BRANCH" ]; then
     14     usage
     15 fi
     16 
     17 shift
     18 shift
     19 
     20 git fetch "$REMOTE" "$BRANCH" "$@"
     21 
     22 exec git checkout -b "$BRANCH" FETCH_HEAD