diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2020-06-17 17:32:49 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2020-06-17 17:35:05 -0400 |
| commit | fc58f4d328281e504ca3cf4b2ff96a0242154e20 (patch) | |
| tree | de84e92dc846b2279bd5a2a796f6a0c6f1287e23 | |
| parent | 525eaccc129682741c55e5964abf3ed3f1896588 (diff) | |
Move publish and wip to scripts.
This makes them a bit more practical to add more sophistication to. `git-publish` in particular can now do more.
| -rw-r--r-- | aliases.gitconfig | 8 | ||||
| -rwxr-xr-x | bin/git-publish | 10 | ||||
| -rwxr-xr-x | bin/git-wip | 6 |
3 files changed, 16 insertions, 8 deletions
diff --git a/aliases.gitconfig b/aliases.gitconfig index 2eaf42e..f619ae5 100644 --- a/aliases.gitconfig +++ b/aliases.gitconfig @@ -35,12 +35,6 @@ bsummary = log --oneline HEAD@{upstream}..HEAD # Aggregate diff of the current branch: `git bdiff [diff options]` bdiff = diff HEAD@{upstream}...HEAD - # Upload a branch to personal fork: `git publish` - note that this - # will unconditionally overwrite the branch if it already exists, - # potentially "losing" changes. Don't `git publish` main or master. Because - # of limitations in git's aliases mechanism, this DOES NOT support `git - # publish BRANCHNAME` the way you'd expect. - publish = !git push "${USER}" +HEAD # "Accept" a branch by merging it: `git accept BRANCHNAME` - this # always creates a merge commit if it succeeds, making it easier to # pick out branch merges in history. (See `git up`, above, for more @@ -78,8 +72,6 @@ # adding an additional comment `git squash COMMITISH` (for example, # `git squash HEAD`). squash = commit --squash - # Create a meaningless commit with a unique message: `git wip`. - wip = "!f() { git this && git commit -m \"wip: $(uuidgen)\"; }; f" ## Working with history # Simple text-based commit graph: `git lol [BRANCHES|--all]` diff --git a/bin/git-publish b/bin/git-publish new file mode 100755 index 0000000..c545825 --- /dev/null +++ b/bin/git-publish @@ -0,0 +1,10 @@ +#!/bin/bash -e + +# Copy your current branch to a "publishing" remote. +# +# By default, this remote is the remote matching your local username. However, +# you can set `publish.remote` to publish to another repository (eg. origin). + +REMOTE="$(git config publish.remote || echo "${USER}")" + +exec git push --force-with-lease "$@" "${REMOTE}" HEAD diff --git a/bin/git-wip b/bin/git-wip new file mode 100755 index 0000000..6a739a8 --- /dev/null +++ b/bin/git-wip @@ -0,0 +1,6 @@ +#!/bin/bash -e + +# Create a meaningless commit with a unique message: `git wip`. + +git this +git commit -m "wip: $(uuidgen)" |
