What’s the use of the staging area in Git?

There are many uses of staging in Git. Some are listed below: staging helps you split up one large change into multiple commits – Let’s say you worked on a large-ish change, involving a lot of files and quite a few different subtasks. You didn’t actually commit any of these — you were “in the … Read more

What does the git index contain EXACTLY?

The Git book contains an article on what an index includes: The index is a binary file (generally kept in .git/index) containing a sorted list of path names, each with permissions and the SHA1 of a blob object; git ls-files can show you the contents of the index: $ git ls-files –stage 100644 63c918c667fa005ff12ad89437f2fdc80926e21c 0 … Read more

What are the differences between “git commit” and “git push”?

Basically, git commit “records changes to the repository” while git push “updates remote refs along with associated objects“. So the first one is used in connection with your local repository, while the latter one is used to interact with a remote repository. Here is a nice picture from Oliver Steele, that explains the Git model … Read more