git - 获取tig提交的sha数

标签 git sha tig

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

但我现在遗漏了一件事。

是否有一个键绑定(bind)来获取我当前所在的 git 提交的 sha 编号?

最佳答案

检查是否在 jonas/tig issue 557 中提出的命令会为你工作:

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

那会复制 current commit SHA1在你的剪贴板中。

Wiki binding page ,您还有 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

OP megas建议in the comments使用 git rev-parse :

bind generic 9 !@sh -c "git rev-parse --short %(commit) | pbcopy"

关于git - 获取tig提交的sha数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52542803/

相关文章:

git-blame - tig 责备 View : How to come back (child commit) after loading parent commit

git push 'pushing'不是新分支

git show-branch 并尝试修复/弄清楚发生了什么

git - 如何在一条规则中 gitignore 具有缩小版本的特定文件?

ssl - 如何使用 keytool 使用 SHA2 签名算法生成受信任的自签名证书?

java crypto SHA512withRSA 不工作 genkeypair

c# - 使用 C# 生成带 key 的 HMAC SHA256 的标准代码是什么

git - Tig 颜色可以不同地提交不同的分支吗?

android - 如何在 CentOS 上运行 repo android?