Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

17
  • 7
    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. Commented Nov 15, 2011 at 9:08
  • 100
    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. Commented Sep 19, 2012 at 17:55
  • 101
    @jiggy git allows you to stage part of a file. You can also stage a file, make further modifications, then commit the state it was in at staging. You can't do that in subversion. Commented Apr 30, 2014 at 0:47
  • 6
    @jiggy In SVN, there is something, between the time that you select which files/parts of files to commit and when you finish writing your commit message, that records which files/parts you selected to commit. It might never be explicitly mentioned, it might be implemented in the SVN client rather than an actual part of the repository, it might just be some flags in memory, but that is SVN's stage. I haven't looked at HG, but I suspect it does the same thing. The difference with git is that git acknowledges that it is a thing, records it to disk, and lets the user get to it directly. Commented Aug 8, 2014 at 20:13
  • 8
    The second arrow "stage files" in the figure might be misleading. "stage hunks" might be more accurate? Commented Oct 10, 2014 at 13:44