aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsrdusr <trevorgray@srdusr.com>2022-12-19 21:29:32 +0200
committersrdusr <trevorgray@srdusr.com>2022-12-19 21:29:32 +0200
commit350ea3230a0f7ab21c507c1e3d1a916995a35514 (patch)
tree189a9b42596eb5b42b8a194f52e669f740580c18
parentd1ccac469f976ec44fc6b255025392a3ca5d19b3 (diff)
downloaddotfiles-350ea3230a0f7ab21c507c1e3d1a916995a35514.tar.gz
dotfiles-350ea3230a0f7ab21c507c1e3d1a916995a35514.zip
New alias for git subtree
-rw-r--r--.config/zsh/.zshrc36
1 files changed, 36 insertions, 0 deletions
diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc
index bf3c734..9b92422 100644
--- a/.config/zsh/.zshrc
+++ b/.config/zsh/.zshrc
@@ -335,6 +335,42 @@ nnn() {
#bindkey -s '^f' 'cd "$(dirname "$(fzf)")"\n'
alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
+#alias cfg='config subtree pull --prefx'
+#alias gsp="git subtree push --prefix=_site git@github.com:mertnuhoglu/blog_datascience.git"
+#alias gsp="git subtree push.local/bin/scripts https://github.com/srdusr/scripts.git main --squash
+function gsp
+{
+ # Config file for subtrees
+ #
+ # Format:
+ # <prefix>;<remote address>;<remote branch>
+ # # Lines starting with '#' will be ignored
+ GIT_SUBTREE_FILE="$PWD/.gitsubtrees"
+
+ if [ ! -f $GIT_SUBTREE_FILE ]; then
+ echo "Nothing to do - file <`basename $GIT_SUBTREE_FILE`> does not exist."
+ return
+ fi
+
+ OLD_IFS=$IFS
+ IFS=$'\n'
+ for LINE in $(cat $GIT_SUBTREE_FILE); do
+
+ # Skip lines starting with '#'.
+ if [[ $LINE = \#* ]]; then
+ continue
+ fi
+
+ # Parse the current line.
+ PREFIX=`echo $LINE | cut -d';' -f 1`
+ REMOTE=`echo $LINE | cut -d';' -f 2`
+ BRANCH=`echo $LINE | cut -d';' -f 3`
+
+ # Push to the remote.
+ echo "config subtree pull --prefix=$PREFIX $REMOTE $BRANCH"
+ config subtree pull --prefix=$PREFIX $REMOTE $BRANCH
+ done
+}
alias vi='nvim'
alias nv='nvim'
alias trash="gio trash"