Home > Software design >  How to avoid readme from deleting while pushing changes on github?
How to avoid readme from deleting while pushing changes on github?

Time:10-14

I push my Django Angular project on GitHub. After that, I add some screenshots of my projects in the readme file of the project on GitHub. But now made some small changes to the local code and I want it to push in the main branch. The problem is when I hit the command git push it fails. I need to use -force. -force delete my readme file because it is not in my local code.

How can I push the code without deleting or without using the -force command?

CodePudding user response:

you get the error because of the reason you said. you don't have the ReadMe file on your local system, so the remote repo and local have conflicts.

Use git pull

it does two thing

  1. git fetch which fetched the state of your remote
  2. git merge merges this state to your local so that they are at the same head.

if you don't want the ReadMe file on your local machine the only option is to do -force or keep deleting.

  • Related