Skip to content

Instantly share code, notes, and snippets.

@ThaiDat
Created July 14, 2023 05:25
Show Gist options
  • Save ThaiDat/8c7fb23a4822e97cb1f527e289e5efbf to your computer and use it in GitHub Desktop.
Save ThaiDat/8c7fb23a4822e97cb1f527e289e5efbf to your computer and use it in GitHub Desktop.
Git extension to publish a new local branch to remote
#!/bin/sh
# Usage: pushes current checkout branch to remote
# Ex: git publish origin
if [ -z ${1+x} ] && [ $(git remote | wc -l) -eq 1 ]; then
remote=$(git remote)
else
remote=$1
fi
git push --set-upstream $remote $(git branch --show-current)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment