i try to push file to github but the file doesnt show
$ git push -u origin master
Everything up-to-date
Branch 'master' set up to track remote branch 'master' from 'origin'.
see my github it show message
master had recent pushes 40 minutes ago
can someone help me, im new to github.
CodePudding user response:
The default branch on Git and GitHub is now called main.
See the note below from this link: https://github.com/github/renaming
Many communities, both on GitHub and in the wider Git community, are considering renaming the default branch name of their repository from master. GitHub is gradually renaming the default branch of our own repositories from master to main. We're committed to making the renaming process as seamless as possible for project maintainers and all of their contributors. This repository is our up-to-date guidance on how and when to rename your default branch.
The first screenshot shows the main
branch and a message to create a pull request and merge the master branch into main, in green, right above it.
You have a few options:
1 - Either work with main
from the beginning
When you create a git repository, the default branch is now called main
. After committing to this branch, simply.
git push -u origin main
2 - Remotely merge master
into main
, delete master
Simply by clicking the GitHub suggested Pull Request message and following the instructions.
3 - Locally merge master
into main
, delete master
:
Merge master
into main
git checkout main
git merge master
git push origin main
Delete master
both locally and remotely
git branch -d master
git push origin --delete master
Verify
To list the local and remote branches and their state:
git branch -avv
Notice
Make sure the main
branch is up to date before pushing, so consider a git pull
and fixing any conflicts as needed before pushing changes.
CodePudding user response:
you want to try and push it to "origin main" instead of "origin master"