Home > Blockchain >  why when use push origin master --force my readme.file was deleted?
why when use push origin master --force my readme.file was deleted?

Time:03-05

why, when I use git push origin master --force my readme. file or some file in my reop was deleted? one day, when I edit my readme file in GitHub unless used git and make commit change, was deleted too, I wont know why this thing done

CodePudding user response:

Every commit is a snapshot of your entire project. Each commit contains all the files. The last commit (also called the head) is the current state of all the current files.

When you do a normal push, your local commits are added to the end of the remote branch. But when you use force, your commits replace the commits of the remote branch.

So if your last local commit does not contain the readme, then after the force push, the remote repo also does not contain it.

  • Related