Why is there a staging process in git?

前端 未结 5 1793
旧巷少年郎
旧巷少年郎 2021-01-01 17:20

Why is there the staging area between \"git add\" and \"git commit\"? I understand the concept, but fail to see the sense in adding files to the staging area before actually

5条回答
  •  萌比男神i
    2021-01-01 18:10

    I've just started exploring the wonderful world of DVCS and although I've already sold my soul to git demon but I still have unbiased view. There is some redundancy in idea of staging area however you can neglect staging area entirely (which I did while I was using github client). On the other hand it gives more flexibility so I would say it's unobtrusive redundancy which sometimes can help you a little.

    What jumped into my mind is that there are too many terms naming it: cache, staging area, index. Obviously this design decision emerged as aggregation of similar concepts and it has some history under it. My first bet proved to be plausible - I went to Bitkeeper site and found "staging" there (they use it for on-demand branching)

    Now I'm guessing that at the time when Bitkeeper was managing Linux sources this feature was misused and instead of creating on-demand branch for several developers it was used just by one developer. And later because this use case proved to be useful Git incorporated lightweight version of "staging area" which is conveniently implemented by providing user interface to "index" or "cache".

提交回复
热议问题