diff --git a/.gitconfig b/.gitconfig index 25462b9..513fe71 100644 --- a/.gitconfig +++ b/.gitconfig @@ -41,6 +41,7 @@ ci = commit -v co = checkout + col = "!. ~/.githelpers && checkout_first_matching" df = "diff --name-only" dfo = "df origin/master" diff --git a/.githelpers b/.githelpers index 9ac1fd2..e72429c 100644 --- a/.githelpers +++ b/.githelpers @@ -97,6 +97,14 @@ delete_all_my_branches_interactive(){ done } +checkout_first_matching() { + if [ -z "$1" ]; then + echo "No pattern provided" + else + git branch | egrep "$1" | head -1 | xargs git checkout + fi +} + TIMESINCE="function timeSince(date) {\ var seconds = Math.floor((new Date() - date) / 1000);\ var interval = Math.floor(seconds / 31536000);\