What is the difference between git push and git pull?

前端 未结 4 1389
北海茫月
北海茫月 2021-01-31 07:37

I just stumbled over something peculiar today. I asked a co-worker at my summer job to help me set up a new remote git repo for my code and there was a lot of confusion about wh

4条回答
  •  情深已故
    2021-01-31 07:56

    Yes, it is working backwards.

    Principle workflow is:

    1. change something locally
    2. commit
    3. push to remote dir

    One use case (another is explained by Dolanor) for not pushing to remote is that a working copy is checked out on the remote (i.e. it's no bare repo). When he wants to push a branch that is checked out on the remote box (e.g. master:master), this will not succeed since pushes to checked-out branches are forbidden.

    In my opinion, that's the only use case for hopping over to the remote machine and pulling instead of pushing from the local machine.

提交回复
热议问题