获取 tig 提交的 sha 数

meg*_*gas 4 git sha tig

我喜欢使用tig客户端来浏览 git 提交。

但我现在缺少一件事。

是否有一个键绑定来获取我目前使用的 git 提交的 sha 号?

Von*_*onC 7

检查jonas/tig问题 557 中提出的命令是否适合您:

bind generic 9 !sh -c "echo -n %(commit) | xclip -selection c && echo Copied %(commit) to clipboard"
Run Code Online (Sandbox Code Playgroud)

这将复制剪贴板中的当前提交 SHA1

Wiki 绑定页面中,您还有 Mac 或 Cygwin 的示例:

bind generic 9 !@sh -c "git show -s --format=%s %(commit) | xclip -selection c" # Linux
bind generic 9 !@sh -c "git show -s --format=%s %(commit) | pbcopy" # Mac
bind generic 9 !@sh -c "git show -s --format=%s %(commit) > /dev/clipboard" # Cygwin
Run Code Online (Sandbox Code Playgroud)

OP MEGAS提出的意见来使用git rev-parse

bind generic 9 !@sh -c "git rev-parse --short %(commit) | pbcopy"
Run Code Online (Sandbox Code Playgroud)