News for hackers. Stuff that matters.
Re:Yank: Yank Terminal Output to Clipboard by michelledepeil on Sunday March 28, 2021 @05:31AM (#26609025)
The final example `yank -- xsel -b` is probably the most directly useful for me, but it still doesn't solve the following problem which irritates me to all hell:

  $ git push
   fatal: The current branch new has no upstream branch.
   To push the current branch and set the remote as upstream, use

    git push --set-upstream origin new

Is there any sane way to copy the perfectly formatted `git push -u` command shown above without resorting to the following eval, which doesn't alias nicely?

  $(git push 2>&1 | grep git)
Re:Yank: Yank Terminal Output to Clipboard by dijit on Sunday March 28, 2021 @05:38AM (#26609056)
I think “thefuck” handles this case really well: https://github.com/nvbn/thefuck
Re:Yank: Yank Terminal Output to Clipboard by michelledepeil on Monday March 29, 2021 @04:10AM (#26618782)
This is perfect, because it's an after-the-fact solution instead of me trying to remember to type the right git command in the first place, much like copy-pasting the suggested command is. Thanks for the suggestion!
Re:Yank: Yank Terminal Output to Clipboard by windmark on Sunday March 28, 2021 @05:45AM (#26609093)
I have the following alias which simply parses the branch name and passes with carts

  alias gpsu='git rev-parse --abbrev-ref HEAD | xargs git push --set-upstream origin'
Re:Yank: Yank Terminal Output to Clipboard by c_thain on Sunday March 28, 2021 @05:40AM (#26609062)
You can also just do

  git push -u origin HEAD