Search code examples
gitclipboardgit-bash

Piping output from Git Bash to clipboard


I often need to relay my Git output to others. The best way I know how is by doing this:

Right-click Git Bash title bar > Edit > Mark > Select lines > Enter

Now everything I selected is in my clipboard. But I'd like to do it on the command line.

In Windows, you can pipe console output to your clipboard like so:

C:\> dir | clip

But when you try to do that in Git Bash, here's what happens:

> git branch | clip
sh.exe": clip: command not found

Is there a way to pipe Git Bash output to my clipboard in Windows?


Solution

  • Well, actualy git branch | clip works fine for me. clip command just calls clip.exe from C:\Windows\System32\. Make sure you have clip.exe installed somewhere in your PATH.