1

I can use git show rev:path/to/file to output the a file as it was in rev, and I would like a rev that points at the staging area. For example:

  • git show HEAD:myfile > myfile.local will cat myfile as it is in the checked-out commit.

  • git show MERGE_HEAD:myfile > myfile.other will cat myfile as it is in the donating branch during a merge.

  • git show XXX:myfile > myfile.staged will cat myfile as it is in the staging area.

My question refers to the last bullet point: is there a symbolic ref XXX that refers to the staged version, or is there no such ref?

(FWIW: I have not found anything in git help revisions, git help show, on Stack Overflow, or via search engines. I'd like to get some corroboration, though, before I conclude something so obviously useful doesn't exist (and that I must propose it on Git's mailing list). Many thanks in advance!)

Esteis
  • 4,669
  • 2
  • 29
  • 45
  • 2
    (This *is* what you were looking for, right?) – Ry- May 18 '18 at 10:17
  • This is indeed the answer I was looking for, thank you! If this question is closed as a duplicate, will it stick around as a redirect to the existing question? The questions are quite differently phrased, although the answer answers both questions. – Esteis May 18 '18 at 11:17
  • Yep, it will. Duplicates are good. – Ry- May 18 '18 at 12:11

0 Answers0