Created
February 25, 2026 19:17
-
-
Save baverman/c2d2391e8a5fc1f5aa103fc798124585 to your computer and use it in GitHub Desktop.
stg helpers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| suffix="${1:?'Fixup suffix is required, i.e "fix"'}" | |
| top="$(stg top)" | |
| base="${top%--*}" | |
| if [ -z "$base" ]; then | |
| echo "stg-fixup expects an applied patch" | |
| fi | |
| default_msg="$(git show "$(stg id "$base")" -s --pretty=format:%s)" | |
| msg="${2:-"$default_msg"}" | |
| stg new -m "$msg" "${base}--${suffix}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| top=$(stg top) | |
| base="${top%--*}" | |
| if [ -z "$base" ]; then | |
| echo "stg-update expects an applied patch" | |
| fi | |
| git push -f ${1:-origin} HEAD:$base |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
It's assumed you already have current patch with associated PR, patch name corresponds to PR name.
To add a fixup patch which should be added as a separate commit to the PR:
"fix" is any short name describing change to differ it in you local stg patches.
To push both patches:
You could do
stg refreshto fix patch and dostg-updateto sync changes.To make another commit in the PR invoke
stg-fixup another-fixand thenstg-updateagain.