【发布时间】:2019-03-03 17:05:03
【问题描述】:
【问题讨论】:
【问题讨论】:
检查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"
【讨论】:
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) - Bind Command。
VonC 的答案中列出的解决方案对我不起作用,因为粘贴的结果中有回车线 (⌘+V)。所以我无法在 tig :!git rebase -i [paste_here_hitting_⌘+V]~ 中输入这样的命令
【讨论】: