miniblog.

← Back to all posts
44
It seems really odd to me that git uses 'cached' terminology for staging. For example, `git add somefile.rs; git diff --cached`. Caching implies state that you don't mind losing. There's very little state I want to lose in version control!

4 Comments

@wilfredh I think the staging area was initially introduced as a cache before the developers realised it could be useful for workflows to directly interact with it. At any rate, most commands that historically took a "--cached" flag will take a "--staged" flag to mean the same thing, which means one less thing to teach new users.
@wilfredh interesting I've always used git diff --staged. I didn't know it was an alias for --cached.
@wilfredh I think this is one of the many occasions where Git terminology leaks some implementation details – "cache" is probably (a part of) the name for the data structure used for staging, or something
Huh, I’ve never run in to that. Apparently `--cached` and `--staged` are synonyms, at least for git diff.