Rename Gitea default branch

From XPUB & Lens-Based wiki
Revision as of 12:28, 8 April 2022 by Manetta (talk | contribs) (Created page with "=On your own computer= ==Clone the repository== $ git clone <repo> $ cd <repo> ==Rename the default branch== $ git branch -m master main $ git status Returns: On b...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

On your own computer

Clone the repository

$ git clone <repo>
$ cd <repo>

Rename the default branch

$ git branch -m master main
$ git status

Returns:

On branch main
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

Push the change

$ git push -u origin main

In Gitea

  • Go to the repository
  • Click "settings"
  • Go to "Branches"
  • Select the renamed branch as the default
  • Click "Update Settings"

On your own computer

Delete the old branch

$ git push origin --delete master