Created
May 12, 2021 08:31
-
-
Save ermshiperete/e8ffae9d0947cf3cab831f6a496f0fc9 to your computer and use it in GitHub Desktop.
git-review
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 -e | |
# Submit a change for review | |
# Allow single-arg options to be passed to push -- principally -n | |
OPTIONS=() | |
while [[ "$1" == -* ]] | |
do | |
OPTIONS+=("$1") | |
shift | |
done | |
COMMIT=${3-HEAD} | |
SOURCE=${2-$(git symbolic-ref -q "$COMMIT" 2>/dev/null || git name-rev --name-only "$COMMIT" 2>/dev/null)} | |
TARGET=${1-develop} | |
SOURCE=${SOURCE#refs/heads/} | |
if [ "$SOURCE" = "$TARGET" ]; then | |
SOURCE= | |
fi | |
git push --signed "${OPTIONS[@]}" origin "$COMMIT:refs/for/$TARGET${SOURCE:+%topic=}$SOURCE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment