From: "Sharan Basappa" <sharan.basa...@gmail.com>
on: Saturday, June 09, 2018 1:11 PM
I would like to know the difference between Git add vs commit.
I would like to know what happens under the hood when we do git add vs git
commit.

Basically, I am confused why there are 2 steps before any change is pushed
onto the remote

The two steps are because the Git philosophy is to create a complete change package, rather than a just the changes to a single file (which may need corresponding changes to other files for the commit to be in a working state). So we have two steps.

The first one (add) allows bits of a complete change within a file to be 'added' (equivalent to someone from the 1950's putting things in an out box), which can be done repeatedly. The itsy-bitsy change are slowy accumulated (with add when needed), until the user is happy that all is good and test (we hope;-).

Having competed all the additions, the user is then ready to commit the package of changes as a cohesive integrated change. Thats the point at which the 1950's coder would call for the secretary to take the completed 'out box' and file it.

You can still look at what changed in a singe file within a commit, but the philosphy is that the cohesive change can be across multiple files.

Hope that helps with a vision about why it helps.

Philip

--
You received this message because you are subscribed to the Google Groups "Git for 
human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to