Skip to content

Instantly share code, notes, and snippets.

@ejona86
Created August 25, 2022 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ejona86/aa4f4ec4d5a8acc26d6f13e81279b211 to your computer and use it in GitHub Desktop.
Save ejona86/aa4f4ec4d5a8acc26d6f13e81279b211 to your computer and use it in GitHub Desktop.
git gh-fetch/gh-push utilities to pull and update PR branches
#!/bin/bash
if [[ $# -ne 2 ]]; then
echo "Usage: $0 REPO_NAME FORK:BRANCH"
exit 1
fi
repo="$1"
user="${2%%:*}"
branch="${2#*:}"
shift 2
exec git fetch "https://github.com/$user/$repo.git" "$branch" "$@"
#!/bin/bash
if [[ $# -ne 2 ]]; then
echo "Usage: $0 REPO_NAME FORK:BRANCH"
exit 1
fi
repo="$1"
user="${2%%:*}"
branch="${2#*:}"
shift 2
exec git push "git@github.com:$user/$repo.git" "HEAD:$branch" "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment