I did make some changes in Github (added some lines and changed a file name), but now my local repo is different from the Github repo.
I would expect that git status
would show which files are different, and then git add .
git commit -m '*'
git push
would make my Github repo the same as my local repo, but it doesn't... How can I fix this?
CodePudding user response:
The git command does not fetch new data from the origin everytime you run it. You will have to first git fetch --all
, in order to get all new changes from the origin or if you don't have uncommitted changes or you have not made commits locally that are not already on GitHub you are able to just do git pull
.
CodePudding user response:
You could try this:
git checkout main
git commit -m "<your-commit-messages>"
git push -f
It will overwrite your Github repo with your local changes.