[英]Take sha number of commit by tig
检查在jonas/tig
问题557中建议的命令是否对您jonas/tig
:
bind generic 9 !sh -c "echo -n %(commit) | xclip -selection c && echo Copied %(commit) to clipboard"
这将在剪贴板中复制当前提交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
OP megas 在评论中建议使用git rev-parse
:
bind generic 9 !@sh -c "git rev-parse --short %(commit) | pbcopy"
bind generic 9 !@sh -c "printf '%s' %(commit) | pbcopy"
或者,复制简短的 sha-1:
bind generic 9 !@sh -c "printf '%s' $(git rev-parse --short %(commit)) | pbcopy"
灵感来源: /tig/doc/tigrc(5) - 示例部分中的绑定命令。
VonC的答案中列出的解决方案对我不起作用,因为粘贴的结果中有返回行 (⌘+V)。 所以我无法在:!git rebase -i [paste_here_hitting_⌘+V]~
输入这样的命令:!git rebase -i [paste_here_hitting_⌘+V]~
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.