开发者

Git cat staged file to stdout

开发者 https://www.devze.com 2023-02-14 08:42 出处:网络
I have staged parts of a fil开发者_如何学Ce in git like so git add --patch ./file I would like to output the contents of the staged file to stdout.

I have staged parts of a fil开发者_如何学Ce in git like so

git add --patch ./file

I would like to output the contents of the staged file to stdout.

Note that the staged file and the file in the working directory are different since I only staged parts of the file.


If you want to just output the complete file in its staged version, you can use the syntax suggested by grawity in answer to a recent question:

git show :file

... or if you want to see the changes between HEAD and the index for that file (typically the changes you've just staged) you can use:

git diff --cached -- file
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号