[英]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.