top | item 41486966

(no title)

jeroen | 1 year ago

> Files in Git can be in one of these three states: Modified, Staged, Committed

> Staged: The current version of the modified file is staged to be included in the next commit.

A bit of a nitpick, but if I change a file, "git add" it, and then change it again, both of these statements are false.

discuss

order

jjmarr|1 year ago

I use git add -p somewhat frequently to do partial staging of a file to split up my changes into multiple commits.

sham1|1 year ago

`git add -p` is such a nice utility. Sometimes I do wish that it could also be used for unstages files, so that if I'm introducing a new file, I could still break its contents up into multiple commits.

Of course, the workaround there is that one adds the initial file into the staging area and then `git add -p` the subsequent changes. It could just be a bit more convenient on that front, is all.

johnisgood|1 year ago

Wow, I have been using git for ages but I did not know about this. I was relying on magit (for Emacs) and git-cola.

gurjeet|1 year ago

I think if the word "Files" was replaced with "A change [in a file]", then the statement holds true. Perhaps a better phrasing:

> In Git, a change in a file, can be in one of these three states: unstaged, Staged, Committed