I often need to relay my Git output to my ever-friendly code buddies. The best way I know how is by doing this:
Right-click Git Bash title bar > Edit > Mark > Select lines > Enter
Bam - everything I selected is in my clipboard, and I am filled with joy.
Problem is, that's the boring way, and I like my relationship with Git to be full of excitement and glamour.
In Windows, you can pipe console output to your clipboard like-a so:
C:\> dir | clip
Amazing, right? Well, when you try to do something that in Git Bash, here's what happens:
> git branch | clip
sh.exe": clip: command not found
And that makes me sad. Is there a way to pipe Git Bash output to my clipboard in Windows so I can once again be filled with joy?
Well, actualy
git branch | clip
works fine for me.clip
command just callsclip.exe
fromC:\Windows\System32\
. Make sure you haveclip.exe
installed somewhere in yourPATH
.@madhead's answer is correct - the
PATH
variable must be set from within git-bash. Here's an elaboration on how to fix this issue, courtesy of Cairnarvon's answer on superuser:To check what
PATH
is currently set to:And to set it, assuming a 64-bit architecture:
Result of
git branch | clip
:copy thing.txt to clipboard
Put contents of clipboard into thing.txt
I aliased these things to pbcopy and pbpaste so I feel like I'm on my mac.