0

I'm not used to git and I'm starting to learn it but I got stuck in pushing the changes into one branch 'Master'.

In github I see that I have 2 branches: Main and Master, after making my changes and afterward I ran the following commands: -git add . -git commit -m 'Commit-text' -git push origin master

And everything is fine since on github I can see the changes but only in the branch 'Master' while the branch 'Main' doesn't result changed. How can I solve this issue?

Ale__ssio
  • 83
  • 7
  • Possible Duplicate of https://stackoverflow.com/questions/23344320/there-isnt-anything-to-compare-nothing-to-compare-branches-are-entirely-diffe – Mohit kumar Jul 27 '21 at 17:48
  • Does this answer your question? [There isn't anything to compare. Nothing to compare, branches are entirely different commit histories](https://stackoverflow.com/questions/23344320/there-isnt-anything-to-compare-nothing-to-compare-branches-are-entirely-diffe) – Anurag Srivastava Jul 27 '21 at 17:52

1 Answers1

0

You can simply solve this problem by going to Git Bash and renaming your main branch:
$ git branch -M [NAME_BRANCH]
so in your case:
$ git branch -M main
GitHub has recently taken the decision to rename its main branches from master to main. So "master" is expected to fall into disuse in the next few years. So what I recommend, whenever you start a new project on Git, is to always rename the main branch from the beginning. So when you push your code, you can safely use only one main branch using the following code:
$ git push origin main

Giuseppe Amato
  • 103
  • 1
  • 1
  • 7