GitHub Gist branch must be "main"
GitHub Gist only recognizes the “main” branch. Git commits on any other branch will not be visible in the Gist interface.
Check the current branch with:
git branch --show-currentIf commits were accidentally made in a non-main branch, change the name of the branch to “main” to make the commits visible in the Gist interface.
git branch -m mainAfter renaming the branch, it may be necessary to force push to update the remote Gist. First, ensure the remote content is in sync with the local branch to avoid overwriting any changes.
# --force overwrites the remote branch with local changes
git push origin main [--force]Check if the old branch was pushed
git ls-remote originIf the old non-main branch (perhaps “master”) still exists on the remote, consider deleting it to avoid confusion.
git push origin --delete masterPerhaps globally configure the computer to always use “main” as the default branch for new repositories:
git config --global init.defaultBranch main