diff --git a/.config/git/config b/.config/git/config index 3c9412f8db017d99941d514e6908f3f1039356bc..388cb135aa2e10acea32f54bd4f5583a0e617859 100644 --- a/.config/git/config +++ b/.config/git/config @@ -9,15 +9,14 @@ cdiff = diff --cached cleaan = clean -dX cleaaan = clean -dx - default-branch = !git rev-parse --abbrev-ref origin/HEAD | cut -d/ -f2 + default-branch = name-rev --name-only origin/HEAD dif = diff --color-words empty-commit = commit --allow-empty exec = "!${SHELL:-/bin/sh} -ic " - ff = merge --no-edit --ff-only master + ff = merge --no-edit --ff-only origin/HEAD fixup = !cd "${GIT_PREFIX:-$PWD}" && git commit --fixup $(git last-commit) forget = reset HEAD^ iec = commit --allow-empty --only --message \"Initial empty commit.\" - master = !git fetch --progress --tags "${1:-origin}" "$(git default-branch):$(git default-branch)" merg = merge --no-edit pop = stash pop posh = push --set-upstream origin HEAD @@ -25,8 +24,6 @@ Pull = pull --progress --ff --tags pull-force = !git fetch && git reset --hard "$(git tracking)" pushes = !git remote | xargs -n1 git push - remaster = !git master && git autorebase "$(git default-branch)" - rerebase = !git autorebase "$(git tracking)" retry = !cd "${GIT_PREFIX:-$PWD}" && git amend --no-edit . && git shove root = rev-parse --show-toplevel serve-git = daemon --reuseaddr --verbose --base-path=. --export-all ./.git diff --git a/Documents/bin/git-master b/Documents/bin/git-master new file mode 100755 index 0000000000000000000000000000000000000000..ddd1662c65d220e8db5966b3abd9fc1a7cb4d32d --- /dev/null +++ b/Documents/bin/git-master @@ -0,0 +1,17 @@ +#!/bin/sh +set -eu + +# Update the default branch without checking out that branch (unless we're +# already on the default branch, then just run git Pull. Accepts 1 paramter, +# the remote name (defaults to origin). + +default_branch="$(git default-branch)" +current_branch="$(git branch --show-current)" +remote="${1:-origin}" + +if [ "$default_branch" = "$current_branch" ] +then + git Pull +else + git fetch --progress --tags "$remote" "$default_branch:$default_branch" +fi diff --git a/Documents/bin/git-remaster b/Documents/bin/git-remaster new file mode 100755 index 0000000000000000000000000000000000000000..7dce2f30c0e79c1dad6d287e5b5c00c51eaf2ce1 --- /dev/null +++ b/Documents/bin/git-remaster @@ -0,0 +1,17 @@ +#!/bin/sh +set -eu + +# Update the default branch using git-remaster, then rebase the current branch +# on the default branch (unless we're already on the default branch, then we're +# just run git Pull). + +default_branch="$(git default-branch)" +current_branch="$(git branch --show-current)" + +if [ "$default_branch" = "$current_branch" ] +then + git Pull +else + git master + git autorebase "$default_branch" +fi