After a Git push, remote repo shows files as deleted

前端 未结 3 774
無奈伤痛
無奈伤痛 2020-12-10 21:30

I cannot find any of the files on my remote repo.

  1. Created a Git repo on shared hosting (site5) as described by their tutorial
  2. init\'d it and added a s
3条回答
  •  有刺的猬
    2020-12-10 21:44

    When you push to a remote repo in Git, it does not update the working copy of that remote repo. This means that the working copy will be out of sync with the last version that you pushed. To avoid this confusion, it is recommended to only push to bare repos; repos that do not have a working copy. The reason is that if anything in the working copy has changed, you will not have a chance to be warned about this and perform a merge, because you are pushing to a remote repo.

    Generally, the only way you should be modifying a working copy is from within it, such as doing a pull or checkout from within that working copy. If you want a copy of your code to be checked out somewhere on your server automatically when you push, you should set up a post-receive hook that will then go a git pull into a repository that has a working copy.

提交回复
热议问题