aboutsummaryrefslogtreecommitdiff
path: root/shellrc.d
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2018-11-29 13:21:09 +0100
committerKarel Kočí <karel.koci@nic.cz>2018-11-29 13:21:09 +0100
commit001e4f345bb8e267844f0eb7dafcbd824a3832f2 (patch)
tree126b576f1ea415a85bc7b91f5a1ced91785deac3 /shellrc.d
parent4d70d5f316dc3721d36bd1f7c63247e56b667b20 (diff)
downloadshellrc-001e4f345bb8e267844f0eb7dafcbd824a3832f2.tar.gz
shellrc-001e4f345bb8e267844f0eb7dafcbd824a3832f2.tar.bz2
shellrc-001e4f345bb8e267844f0eb7dafcbd824a3832f2.zip
git: Add gitbcheckout
Diffstat (limited to 'shellrc.d')
-rw-r--r--shellrc.d/git15
1 files changed, 11 insertions, 4 deletions
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"
}