Understanding git init

后端 未结 5 1395
情书的邮戳
情书的邮戳 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:13

    Your three four understandings are more or less correct, though you're missing a few details.

    git init initialises (i.e. creates) a repository. Each project should be in its own repository.

    If you downloaded your project using git clone then you don't need to run git init again.

    You should be able to copy your project to another directory without any adverse effects. That path was probably chosen by default. Be sure to move the whole directory. The metadata that git needs to run is stored in hidden files in the project's directory.

    Pushing and pulling can get complicated, especially when you're working on a project with others, and when you're using branches. It's not really sensible for me to write out a complete intro to the topic here, so I'd suggest you go read Pro Git for a more thorough explanation.

提交回复
热议问题