Getting Git-concept of “stage”

前端 未结 3 1831
南旧
南旧 2021-01-05 06:30

Still having a hard time getting my head wrapped around the concept of staging as it applies to Git.

Can any analogies be made with SVN? What is the primary purpose

3条回答
  •  鱼传尺愫
    2021-01-05 06:57

    Similarities:

    Files that should be part of the repository must be added in order to being tracked. Both tools use the add command to accomplish this. Adding files means to prepare a commit.

    Differences:

    Git allows some further kind of detail when adding files. You can decide to add a whole file or distinct lines of code. Adding files to the index or stage allows more flexibility. SVN automatically commits all changes on a file that has already been added to the repository. Git leaves the decision of what changes to associate with each commit operation to the user. In other words: the next commit in Git only contains those changes (lines or files) that have been staged, regardless of the tracking status of the files. SVN automatically includes all changes on tracked files.

    Additional information:

    Try to read some posts describing Git workflows such as the one from Oliver Steele. But be aware that there is not one way to use Git - there are many. If you want, you can use Git as if you were working with SVN.
    Do not expect to understand the philosophy of Git in a short period of time. It took me a year to get into it and I still learn new ways to use it. I think it is even harder if you grew up with SVN mindset. There are tons of materials out there: articles, videos, ... - take your time and try some of them. Here is a selection from the list I collected.

    • Git Immersion
    • Think Like (a) Git
    • The Git Parable
    • Git Tutorial by Lars Vogel
    • Links and background information collected by tekkub

提交回复
热议问题