Getting Git-concept of “stage”

前端 未结 3 1848
南旧
南旧 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

    Here are some of the scenarios that show the usefulness of staging:

    • You work on a particular piece and have made quite a few changes across your project. You don't want to commit them yet before testing out the full thing. But these changes can often be independent enough to make multiple logical commits than a single big one. This is when you stage selective parts and make multiple commits.

    • Staging has been especially helpful while debugging. You can sprinkle around the log statements to track the source of the bug. Then you make the fix, and test again using those log statements. But then, you want to commit the fix before making any change in the code to delete those log statements.

    • Another scenario where it has proved to be helpful is when you are in the middle of doing something, and find something unrelated, like a typo error, that you want to fix and get it out of the way quickly.

    There are several other such scenarios, and probably you wouldn't be able to work with anything that lacks this concept, once you get a hang of it :).

    PS: I have not used SVN at all, so can not make the comparisons between the two.

提交回复
热议问题