windows - Git Bash 如何像 Git Shell 一样显示有关 repo 文件的信息

标签 windows git git-bash

我在 Windows 上使用 Git Bash。但之前,我一直在使用 Git Shell(来自 github)。在 Git Shell 中这真是太棒了,见下图:

enter image description here

在 Git Shell 中,我不需要使用 git status 来查看我有多少未跟踪、更改或删除的文件。Git Shell 在任何命令后显示该信息.

我如何为 Git Bash(在 Windows 上)执行此操作?

最佳答案

您可以简单地操作 PS1 变量,这样的事情可能对您有帮助:

$ PS1="$PS1 [`git diff --shortstat`]> "

结果应该是这样的:

rlegendi@localhost /.../gitrepo (master)
[ 1 file changed, 3 insertions(+)] >

所以基本上你必须将这个添加到你的 profile 文件中(通常在 Git 安装目录 c:\Program Files (x86)\Git\etc 下)或在您的主目录中)。这样您就可以创建一个更好的版本。

查看 PROMPT_COMMAND 和不同的 git diff switches (如 --numstat 等)。

关于windows - Git Bash 如何像 Git Shell 一样显示有关 repo 文件的信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12871154/

相关文章:

c# - 窗口应用程序崩溃

c++ - 使用内联 ASM 获取字符串

linux - git 在提交 linux 时使用 root 而不是我的用户名

windows - 是否可以在 Windows 10 git-bash 中使用 fzf(命令行模糊查找器)?

bash - 如何将带空格的参数从 bash 脚本传递到 bash 脚本?

windows - 一诺设置 : How to get the primary monitor's resolution?

html - CSS :after background in Safari for Windows

Git:如何从改变的历史中恢复?

git - 如何更改git中的基本分支?

Windows 的 docker --volume 格式