0
git push origin master

So I tried git push origin master and it has created a new branch master. Turns out, my main branch is main while the past repos that i tried had master as main branch. How do I solve this? How can I merge these branches or make master my default branch?

charlie arehart
  • 6,590
  • 3
  • 27
  • 25
  • 1
    Related but a bit different: [How do I update my GitHub mirror due to the master/main change?](https://stackoverflow.com/q/64618081/1256452) – torek Jul 28 '21 at 02:08
  • Closely related, maybe still not a duplicate: [My Github repo has 'main' and 'master' branches - what is their purpose?](https://stackoverflow.com/q/65020647/1256452) – torek Jul 28 '21 at 02:09
  • Very closely related: [How to merge main and master branches?](https://stackoverflow.com/q/65369949/1256452) – torek Jul 28 '21 at 02:11
  • Not to mention https://www.biteinteractive.com/of-git-and-github-master-and-main/ – matt Feb 26 '22 at 14:18

2 Answers2

0

If you want to rename a branch, use the command:
git branch -M [NAME_BRANCH]

so in your case:
git branch -M master
as soon as you have renamed the branch 'master', you can continue as if nothing had happened

Giuseppe Amato
  • 103
  • 1
  • 1
  • 7
-1

git branch -M master

use the upper command to rename your master branch