DEV Community

Cover image for Git push for dummies
Francesco Bianco
Francesco Bianco

Posted on

2 3

Git push for dummies

Too many developer see this message after a git push, than try to googling for a solution (in the meantime the AI is getting ready)

ubuntu@skynet:~/ (feature/T1000) $ git push

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

     git push --set-upstream origin master
Enter fullscreen mode Exit fullscreen mode

But, not being able to read the last line because of the white spaces that interrupt the flow of strings on the screen.

Proposed solution

Then we thought to help them in this way:

git push || $(git push 2>&1 | grep "." | tail -1)
Enter fullscreen mode Exit fullscreen mode

They will then be able to create an alias to manage the git push for dummies.

Top comments (1)

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt

You just have to git push -u origin master at sometime before. That's all.

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay