After pushing the local repository to github, i am getting this error on github.
Compare & pull request master had recent pushes 2 minutes ago
Images for reference:: [1]: https://i.stack.imgur.com/Jb3jH.jpg
CodePudding user response:
Background
You're being notified that the master
branch has been updated because your default branch in GitHub is set to main
; I can tell this from your screenshot.
This isn't an error reported by GitHub; you're being prompted to raise a Pull Request to merge the changes from master
into main
.
GitHub now sets main
to be the default branch. What's likely happened is that your local git
installation has master
set to the default or you've created the master
branch by some other means, such as a script.
$ git branch
Will list all of the branches you have locally.
My recommendation of what to do:
Click on that "Compare & pull request" button to create a pull request. Review your changes and then merge into main
.
After this is done:
First ensure you have no local changes by running
git status
. If you do you may want to go through the same Pull Request process until you have committed everything.
$ git checkout main
$ git pull
At this point you will now have the most up-to-date version of the main
branch and from here on you can work on this branch
. Pushing to main
won't show the same green "Compare & pull request" button as it does when pushing to master
.