是否有指定暂存文件的 git 修订规范?
Is there a git rev spec that specifies the staged file(s)?
为了让脚本实现更简单,我想做类似的事情:
diff <(git show HEAD:file | awk ...) <(git show STAGED:file | awk ...)
是否有指定暂存文件的修订规范?
我在 .git/refs
下没有看到任何引用暂存对象的内容。
但是,您可以:
$ git stash file
$ diff <(git show HEAD:file | awk ...) <(git show stash:file | awk ...)
$ git stash apply
从 the Git Revision Man page 你可以用
实现你想要的
git show :0:file
除非您正在进行合并 :0: 或只是 : 应该适合您。
::, e.g. :0:README, :README A colon, optionally followed by a
stage number (0 to 3) and a colon, followed by a path, names a blob
object in the index at the given path. A missing stage number (and the
colon that follows it) names a stage 0 entry. During a merge, stage 1
is the common ancestor, stage 2 is the target branch’s version
(typically the current branch), and stage 3 is the version from the
branch which is being merged.
为了让脚本实现更简单,我想做类似的事情:
diff <(git show HEAD:file | awk ...) <(git show STAGED:file | awk ...)
是否有指定暂存文件的修订规范?
我在 .git/refs
下没有看到任何引用暂存对象的内容。
但是,您可以:
$ git stash file
$ diff <(git show HEAD:file | awk ...) <(git show stash:file | awk ...)
$ git stash apply
从 the Git Revision Man page 你可以用
实现你想要的git show :0:file
除非您正在进行合并 :0: 或只是 : 应该适合您。
::, e.g. :0:README, :README A colon, optionally followed by a stage number (0 to 3) and a colon, followed by a path, names a blob object in the index at the given path. A missing stage number (and the colon that follows it) names a stage 0 entry. During a merge, stage 1 is the common ancestor, stage 2 is the target branch’s version (typically the current branch), and stage 3 is the version from the branch which is being merged.