取tig的sha提交数 [英] Take sha number of commit by tig

查看:67
本文介绍了取tig的sha提交数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢使用 tig 客户端浏览git commit.

但是我现在错过了一件事.

是否存在用于获取我当前停留的git commit的sha数量的键绑定?

解决方案

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

 绑定通用9!sh -c"echo -n%(commit)| xclip -selection c&& echo复制的%(commit)到剪贴板" 

那会在剪贴板中复制当前提交SHA1 ./p>

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

 绑定通用9!@sh -c"git show -s --format =%s%(commit)| xclip -selection c"#Linux绑定通用9!@sh -c"git show -s --format =%s%(commit)| pbcopy"#Mac绑定通用9!@sh -c"git show -s --format =%s%(commit)>/dev/clipboard"#Cygwin 

OP兆建议

I love to use tig client to navigate through git commits.

But I'm missing one thing for now.

Is there a key binding to take a sha number of a git commit I'm currently staying at?

解决方案

Check if the command proposed in jonas/tig issue 557 would work for you:

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

That would copy the current commit SHA1 in your clipboard.

In the Wiki binding page, you also have example for Mac or 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

The OP megas proposes in the comments to use git rev-parse:

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

这篇关于取tig的sha提交数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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