Naposledy aktivní 1732918080

melanie's Avatar melanie revidoval tento gist 1732918080. Přejít na revizi

1 file changed, 25 insertions

no-masters.md(vytvořil soubor)

@@ -0,0 +1,25 @@
1 + # Make Git always use `main` as default branch
2 +
3 + ## Git 2.28.0
4 +
5 + ```sh
6 + git config --global init.defaultBranch main
7 + ```
8 +
9 +
10 + ## Pre-Git 2.28.0
11 +
12 + ```sh
13 + mkdir -p ~/.config/git/templates/default
14 + echo "ref: refs/heads/main" > ~/.config/git/templates/default/HEAD
15 + git config --global init.templateDir '~/.config/git/templates/default'
16 + ```
17 +
18 +
19 + ## Make main your main
20 +
21 + `git branch -m master main && git push -u origin main`
22 +
23 + Next, tell GitHub or whoever your new default is `main`. Then you can tell the remote repo to destroy the old branch:
24 +
25 + `git push origin :master`
Novější Starší