Skip to content

Instantly share code, notes, and snippets.

@ThaiDat
Created July 14, 2023 05:25
Show Gist options
  • Select an option

  • Save ThaiDat/8c7fb23a4822e97cb1f527e289e5efbf to your computer and use it in GitHub Desktop.

Select an option

Save ThaiDat/8c7fb23a4822e97cb1f527e289e5efbf to your computer and use it in GitHub Desktop.

Revisions

  1. ThaiDat created this gist Jul 14, 2023.
    10 changes: 10 additions & 0 deletions git-publish
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    #!/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)