[{"data":1,"prerenderedAt":161},["ShallowReactive",2],{"\u002Farticles\u002Fmy-main-branch":3},{"id":4,"title":5,"body":6,"createdAt":151,"description":152,"extension":153,"meta":154,"navigation":155,"path":156,"rawbody":157,"seo":158,"stem":159,"__hash__":160},"articles\u002Farticles\u002Fmy-main-branch.md","My main branch",{"type":7,"value":8,"toc":148},"minimark",[9,30,78,93,98,114,134,144],[10,11,12,13,17,18,21,22,29],"p",{},"Over the last few months, the web community has been vying to move away from \"master\u002Fslave\" terminology. I (as well as many others) have started addressing this in my own work been replacing ",[14,15,16],"code",{},"master"," branches with ",[14,19,20],{},"main",", including ",[23,24,28],"a",{"href":25,"rel":26},"https:\u002F\u002Fgithub.com\u002Fnotnek\u002Fsite",[27],"nofollow","this site",". You can also do this easily with the following two commands:",[31,32,37],"pre",{"className":33,"code":34,"language":35,"meta":36,"style":36},"language-bash shiki shiki-themes github-light github-dark","git branch -m master main\ngit push -u origin main\n","bash","",[14,38,39,62],{"__ignoreMap":36},[40,41,44,48,52,56,59],"span",{"class":42,"line":43},"line",1,[40,45,47],{"class":46},"sScJk","git",[40,49,51],{"class":50},"sZZnC"," branch",[40,53,55],{"class":54},"sj4cs"," -m",[40,57,58],{"class":50}," master",[40,60,61],{"class":50}," main\n",[40,63,65,67,70,73,76],{"class":42,"line":64},2,[40,66,47],{"class":46},[40,68,69],{"class":50}," push",[40,71,72],{"class":54}," -u",[40,74,75],{"class":50}," origin",[40,77,61],{"class":50},[10,79,80,81,83,84,89,90,92],{},"This will keep all of your history, but under a ",[14,82,20],{}," branch. Tools like ",[23,85,88],{"href":86,"rel":87},"https:\u002F\u002Fdocs.github.com\u002Fen\u002Fgithub\u002Fadministering-a-repository\u002Fchanging-the-default-branch",[27],"GitHub"," can automatically make ",[14,91,20],{}," your default branch as well.",[94,95,97],"h2",{"id":96},"setting-main-as-your-initial-branch","Setting main as your initial branch",[10,99,100,101,106,107,110,111,113],{},"On July 27, 2020, version ",[23,102,105],{"href":103,"rel":104},"https:\u002F\u002Flore.kernel.org\u002Fgit\u002Fxmqq5za8hpir.fsf@gitster.c.googlers.com\u002F",[27],"2.28.0 of Git was released"," with a new configuration option named ",[14,108,109],{},"init.defaultBranch"," that allows you to set your initial branch instead of it being hardset to ",[14,112,16],{},". You can set this configuration with the following line:",[31,115,117],{"className":33,"code":116,"language":35,"meta":36,"style":36},"git config --global init.defaultBranch main\n",[14,118,119],{"__ignoreMap":36},[40,120,121,123,126,129,132],{"class":42,"line":43},[40,122,47],{"class":46},[40,124,125],{"class":50}," config",[40,127,128],{"class":54}," --global",[40,130,131],{"class":50}," init.defaultBranch",[40,133,61],{"class":50},[10,135,136,137,140,141,143],{},"Now any time you run ",[14,138,139],{},"git init",", the repo will be instantiated with a ",[14,142,20],{}," branch.",[145,146,147],"style",{},"html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":36,"searchDepth":64,"depth":64,"links":149},[150],{"id":96,"depth":64,"text":97},"2020\u002F07\u002F28","I'm replacing master with main in my git repos.","md",{},true,"\u002Farticles\u002Fmy-main-branch","---\ntitle: My main branch\ndescription: I'm replacing master with main in my git repos.\ncreatedAt: 2020\u002F07\u002F28\n---\nOver the last few months, the web community has been vying to move away from \"master\u002Fslave\" terminology. I (as well as many others) have started addressing this in my own work been replacing `master` branches with `main`, including [this site](https:\u002F\u002Fgithub.com\u002Fnotnek\u002Fsite). You can also do this easily with the following two commands:\n\n```bash\ngit branch -m master main\ngit push -u origin main\n```\n\nThis will keep all of your history, but under a `main` branch. Tools like [GitHub](https:\u002F\u002Fdocs.github.com\u002Fen\u002Fgithub\u002Fadministering-a-repository\u002Fchanging-the-default-branch) can automatically make `main` your default branch as well.\n\n## Setting main as your initial branch\nOn July 27, 2020, version [2.28.0 of Git was released](https:\u002F\u002Flore.kernel.org\u002Fgit\u002Fxmqq5za8hpir.fsf@gitster.c.googlers.com\u002F) with a new configuration option named `init.defaultBranch` that allows you to set your initial branch instead of it being hardset to `master`. You can set this configuration with the following line:\n\n```bash\ngit config --global init.defaultBranch main\n```\n\nNow any time you run `git init`, the repo will be instantiated with a `main` branch.\n",{"title":5,"description":152},"articles\u002Fmy-main-branch","8qdyswfwJC5NoJ-XJ7XuKLAYK5x4K1wCJ0jQpreRNRo",1794024371781]