From 001e4f345bb8e267844f0eb7dafcbd824a3832f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 29 Nov 2018 13:21:09 +0100 Subject: git: Add gitbcheckout --- shellrc.d/git | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'shellrc.d') diff --git a/shellrc.d/git b/shellrc.d/git index 47edae5..1403ea4 100644 --- a/shellrc.d/git +++ b/shellrc.d/git @@ -19,11 +19,18 @@ gitbmerge() { ) } +# Checkout branch to new work tree +gitbcheckout() { + local nw + nw="$(git rev-parse --show-toplevel)-$1" + git worktree add "$nw" "$1" + cd "$nw" + git submodule update --init --recursive +} +alias gitbco='gitcheckout' + # Create new branch from HEAD gitbnew() { git branch "$1" HEAD - local NW="$(git rev-parse --show-toplevel)-$1" - git worktree add "$NW" $1 - cd "$NW" - git submodule update --init --recursive + gitbcheckout "$1" } -- cgit v1.2.3