Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I find git hard to understand as I could not find the meaning of used words for the actions, I checked the dictionary for the meaning of stage and none of the meanings was related to source control concepts.

Can anybody help me with understanding the meaning of stage in context of git source control?

share|improve this question
add comment

4 Answers

To stage a file is simply to prepare it finely for a commit. Git, with its index allows you to commit only certain parts of the changes you've done since the last commit. Say you're working on two features - one is finished, and one still needs some work done. You'd like to make a commit and go home (5 o'clock, finally!) but wouldn't like to commit the parts of the second feature, which is not done yet. You stage the parts you know belong to the first feature, and commit. Now your commit is your project with the first feature done, while the second is still in work-in-progress in your working directory.

share|improve this answer
Good explanation. Note that git, being distributed, obviously allows you to commit both features, since commits are local (at first). Still, you might want to put split the modifications into one commit per feature, and again staging comes in handy. –  sleske Nov 15 '11 at 9:08
I don't understand why you need staging for this. I can do this with HG or even SVN by only committing the relevant files. It feels like this feature is primarily designed to aid people who insist on working with the command line where it's harder to check boxes on what you are committing. –  jiggy Sep 19 '12 at 17:55
add comment

Since everyone so far has answered it the "formal" way, let me do this with alternatives to enhance learning with the power of metaphors.

So the staging area is like:

  • a cache of files that you want to commit
  • not a series of tubes but actually a dumptruck, ready to move the work you load it with, in to the repository
  • a magical place where selected files will be turned into stone with your wizardry and can be magically transported to the repository at your whim
  • the yellow brick road for the files to go happily to the repository (or fall off if you want to revert)
  • the fictional place at the sea port where files are recieved a pair of cement shoes and then thrown into the repository sea
  • the receptions desk at the library, you put the files there for the librarian to prepare for filing into the library
  • a box where you put things in before shoving it under your bed, where your bed is a repository of boxes you've previously have shoved in
  • the loading bay of files before it goes into the repository warehouse with the power loader
  • the filter of an electric drip coffeemaker, if the files is like the coffee powder then the commited files is the brewed coffee
  • the Scrooge McDuck's office next to the vault, the files is like the coins before they go into the vault of his massive Money Bin
  • the pet store, once you bring a pet home you're committed

It's magical!

share|improve this answer
If one of those doesn't stick I don't know what will. ;p –  Steven Jeuris Nov 15 '11 at 8:09
+1 for the repository sea. –  Bringer128 Nov 15 '11 at 8:26
Thanks for the great explanations, it helped me understood and memorize the concept. –  Sam Nov 15 '11 at 14:17
+1 for Scrooge McDuck –  Baggers Nov 4 '13 at 10:38
+1, I don't get it. LOL kidding, great job with the metaphors. –  MHZ Mar 20 at 20:10
show 1 more comment

To stage a file is to prepare it for a commit. Because git exposes this action to the users control it allows you to create partial commits, or to modify a file, stage it, modify it again, and only commit or revert to the original modification.

Staging allows you finer control over exactly how you want to approach version control.

share|improve this answer
Good explanation. –  MHZ Mar 20 at 20:11
add comment

To add to the other excellent answers, here's where the name for "stage" comes from:

I checked the dictionary for the meaning of stage and none of the meanings was related to source control concepts.

In English, "to stage" can mean

organize and participate in (a public event): UDF supporters staged a demonstration in Sofia

(from http://oxforddictionaries.com/definition/stage )

The name "staging" for the git feature derives from this meaning: When staging, you are preparing and organizing a commit. Of course a commit is not quite the same as a performance, but it is an important event in a VCS :-).

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.