3 ms·
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
by michelledepeil 6y ago
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)
- dijit 6y agoI think “thefuck” handles this case really well: https://github.com/nvbn/thefuck https://github.com/nvbn/thefuck
- michelledepeil 6y agoThis 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!
- c_thain 6y agoYou can also just do git push -u origin HEAD
- windmark 6y agoI 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'