Skip to content

Instantly share code, notes, and snippets.

@DevoKun
Last active June 28, 2022 20:38
Show Gist options
  • Save DevoKun/f9d1653d16a91226c15b96f5f561432c to your computer and use it in GitHub Desktop.
Save DevoKun/f9d1653d16a91226c15b96f5f561432c to your computer and use it in GitHub Desktop.

Revisions

  1. DevoKun revised this gist Jun 15, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion change_github_master_branch_name.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@

    git pull
    git pull # Pull first or lose ANY commits upstream
    git branch -m master main # Rename branch locally
    echo
    echo "Change GitHub default branch to 'main'."
  2. DevoKun renamed this gist Jun 13, 2020. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. DevoKun created this gist Jun 13, 2020.
    12 changes: 12 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@

    git pull
    git branch -m master main # Rename branch locally
    echo
    echo "Change GitHub default branch to 'main'."
    echo
    echo "Is GitHub Default Branch 'main'?"
    echo
    read -p "Press ENTER to continue"
    echo
    git push origin :master # Delete the old branch
    git push --set-upstream origin main # Push the new branch, set local branch to track the new remote