Understanding git init

后端 未结 5 1396
情书的邮戳
情书的邮戳 2021-01-30 14:57

What is git init for exactly? Must I do it once per computer or once per project that uses git? I downloaded my project by git clone and got it working

5条回答
  •  执念已碎
    2021-01-30 15:12

    @Jaanus just one addition to what @slebetman explained regarding git pull. It's not exactly syncing but rather fetching the commits which are not on your local. This is more of a corner case, consider the following -

    1. Assuming to be dealing with a branch test_branch. A, B and C commits exist for origin/test_branch (the branch on your git server) where C is the most recent commit. You have taken a pull and now have A, B and C on your local branch too.

    2. Let's say for some reason you had to reset the commit B and force re-write history of origin/test_branch leaving the history to be A and C.

    3. Now when you perform git pull onto your local. It is going to say everything already up to date but notice you have additional changes of commit B. Therefore, do not consider this as a sync operation but more of a get what I don't have operation.

    Hope that was helpful.

提交回复
热议问题