config/git: move git-fork to script

This commit is contained in:
xeruf 2021-06-19 21:24:14 +02:00
parent 63c7a24788
commit bfcaeb7436
4 changed files with 17 additions and 10 deletions

View File

@ -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 {{{

11
.local/bin/scripts/git-fork Executable file
View File

@ -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

View File

@ -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})"

3
.local/bin/scripts/git-pn Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
# Push HEAD to a new branch in origin
git push origin "HEAD:$1"