diff --git a/.config/shell/git b/.config/shell/git index 9ee01dd..44247c4 100644 --- a/.config/shell/git +++ b/.config/shell/git @@ -80,13 +80,6 @@ project() { fi } -gitfork() { - builtin cd "$projects_dir/_forks" - gitclone github.com "$1" "" "$3" --recurse-submodules || return $? - test "$2" && git remote add upstream "$(gitremote github.com "$1" "$2")" - git remote -v -} - # }}} # Rewriting history {{{ diff --git a/.local/bin/scripts/git-fork b/.local/bin/scripts/git-fork new file mode 100755 index 0000000..ee88bca --- /dev/null +++ b/.local/bin/scripts/git-fork @@ -0,0 +1,11 @@ +#!/bin/sh +# Clones a fork and sets a corresponding upstream +# Args: +# - repo name +# - upstream user +# - local user +# - target directory name +set -e +git-get github.com "$1" "$3" "${@:4}" +test "$2" && git remote add upstream "$(gitremote github.com "$1" "$2")" +git remote -v diff --git a/.local/bin/scripts/git-get b/.local/bin/scripts/git-get index 50e94a7..09adc5c 100755 --- a/.local/bin/scripts/git-get +++ b/.local/bin/scripts/git-get @@ -1,6 +1,6 @@ #!/bin/sh # Clones from resolving the arguments and switches into the new directory -remote=$(gitremote "$@") -echo $remote -git clone $remote ${@:4} || return $? +remote=$(git-repo "$@") +echo "Cloning $remote" +git clone $remote ${@:4} --recurse-submodules || return $? cd "$(test $4 && echo $4 || basename ${remote%.git})" diff --git a/.local/bin/scripts/git-pn b/.local/bin/scripts/git-pn new file mode 100755 index 0000000..a0d67c7 --- /dev/null +++ b/.local/bin/scripts/git-pn @@ -0,0 +1,3 @@ +#!/bin/sh +# Push HEAD to a new branch in origin +git push origin "HEAD:$1"