gpt4 book ai didi

git - 如何详细显示 Git 中未提交的更改和一些 Git 差异

转载 作者:IT王子 更新时间:2023-10-29 01:19:01 39 4
gpt4 key购买 nike

我如何在 Git 中显示未提交的更改?

STFW'ed ,并且这些命令不起作用:

teyan@TEYAN-THINK MINGW64 /d/nano/repos/PSTools/psservice (teyan/psservice)
$ git status
On branch teyan/psservice
Your branch is up-to-date with 'origin/teyan/psservice'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)

modified: psservice.c
modified: psservice.vcxproj.filters


teyan@TEYAN-THINK MINGW64 /d/nano/repos/PSTools/psservice (teyan/psservice)
$ git diff

teyan@TEYAN-THINK MINGW64 /d/nano/repos/PSTools/psservice (teyan/psservice)
$ git diff master
fatal: ambiguous argument 'master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

最佳答案

How to show uncommitted changes in Git

您要查找的命令是git diff .

git diff - Show changes between commits, commit and working tree, etc


这是它公开的一些您可以使用的选项

git diff(无参数)
打印出您的工作目录和索引之间的差异。

git diff --cached:
打印出 index 和 HEAD(当前提交)之间的差异。

git diff HEAD:
打印出您的工作目录 和 HEAD 之间的差异。

git diff --name-only
仅显示已更改文件的名称。

git diff --name-status
仅显示已更改文件的名称和状态

git diff --color-words
逐字差异而不是逐行差异。

这是 git diff --color-words 的输出示例:

enter image description here


enter image description here

关于git - 如何详细显示 Git 中未提交的更改和一些 Git 差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35978550/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com