0

I'm starting to learn Git, but I don't understand the need for an intermediate phase before committing the code? If I make changes to my code, what does commit stage actually do?

  • 2
    The staging area allows you to setup what you actually want to commit having the luxury of adding/removing stuff from it at will.... it can be as helpful as just being able to select _sections_ of a modified file to add to index (with _add interactive_). There are actually _many_ other tricks that having the staging area allows (using resets and so on) but I think that's the most obvious one. – eftshift0 Oct 28 '22 at 09:00
  • 2
    Note that most of the answers in the first duplicate are of the form "ew, yuck, staging area, bad idea" while most of the answers in the second are of the form "yay, staging area". Whether the index / staging-area is a *good idea* is a matter of opinion, but because Git has it and uses it extensively, it's important to know that Git has it. GUIs that hide it from you are doing you a disservice. – torek Oct 28 '22 at 09:11

0 Answers0