Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Use this to checkout a branch ending with a certain string
#!/usr/bin/env bash
branch=`git branch -a | egrep -io "([^/]+/)?[^/]+$1$" | sed 's/* //' | head -1`
git checkout $branch
@peregrinogris
Copy link
Author

peregrinogris commented Nov 4, 2014

Store it under /usr/local/bin/git-usebranch and add a git alias from usebranch to use, then:

git use 440

@juanrossi
Copy link

juanrossi commented Sep 29, 2015

To setup alias edit ~/.gitconfig:

[alias]
    use = usebranch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment