如何使用tig查看已更改但未提交的文件的差异? [英] How do I use tig to view the diff for a file which is changed but not commited?

查看:182
本文介绍了如何使用tig查看已更改但未提交的文件的差异?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在git中,它是 git diff< file path> ,但在tig中怎么样?在tig中,在状态视图中,突出显示一个文件(staged或unstaged)并按 D ,会区分上次提交。我认为它应该将未提交的文件与该文件的最后提交版本进行比较。

解决方案

作为一种破解方式,您可以执行 git diff< file path> | tig 并查看它。



状态部分中 tig 你可以看到stage和unstaged的变化(比如 git diff vs git diff --cached code>),然后按 Enter 键显示每个部分的文件(位于要提交的更改或更改但未更新下)。

对于 tig diff - < file path> 也许是一个很好的功能,但是,请继续前进,对其进行编码:)


In git, it is git diff <file path>, but what about in tig?

In tig, in the status view, highlighting a file (staged or unstaged) and pressing D, diffs the last commit. I think it should diff the uncommitted file against the last committed version of that file.

解决方案

As a hack, you can do git diff <file path> | tig and see it.

On the status section in tig you can see both the staged and unstaged changes (say, git diff vs git diff --cached) pressing Enter over the file in each of the sections it appears (under "Changes to be committed" or "Changed but not updated").

It may be a nice feature to just tig diff -- <file path> but, well - go ahead, code it :)

这篇关于如何使用tig查看已更改但未提交的文件的差异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆