Advertisement
Guest User

Untitled

a guest
Sep 20th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. mkdir -p $HOME/bin && export PATH=$PATH:$HOME/bin && printf '#!/bin/bash\n\nif [[ ! $1 ]]; then\n echo "Error: Argument 1 should be string containing the name of the branch"\n exit 1\nfi\n\nis_remote_branch=$(git branch -a | grep -m 1 $1 | grep origin)\nbranch_name=$(git branch -a | grep -m 1 $1)\n\nif [[ ! $branch_name ]]; then\n echo "Error: cant find branch $1"\n exit 1\nfi\n\nif [[ $is_remote_branch ]]; then\n git checkout --track ${branch_name/"*"/} \nelse\n git checkout ${branch_name/"*"/}\nfi\n' > $HOME/bin/gitc && chmod +x $HOME/bin/gitc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement