this post was submitted on 03 Mar 2024
1097 points (97.8% liked)

Programmer Humor

19564 readers
635 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 6 points 8 months ago (2 children)
[–] [email protected] 23 points 8 months ago* (last edited 8 months ago) (1 children)

You can default git to using your current branch and a specific upstream so you don't have to put anything after git push

[–] [email protected] 4 points 8 months ago (1 children)
[–] [email protected] 6 points 8 months ago

Has git never told you that you should use git push -u origin when you push a new branch for the first time?

[–] [email protected] 16 points 8 months ago (1 children)

The first time you manually push like that, you can add the -u flag (git push -u origin master) to push and set the branch's default upstream. Afterwards, a plain git push while that branch is checked out will push the branch to that default upstream. This is per-branch, so you can have a main branch that pulls from one repository and a patch branch that pulls and pushes to a different repository.

[–] [email protected] 6 points 8 months ago (1 children)

My strategy is to just type git push and get some kind of error message about upstream not being set or something. That's a signal for me to take a second to think about what I'm actually doing and type the correct command.

[–] [email protected] 1 points 8 months ago

That's a signal for me to

... google the error and randomly try stack overflow answers without really understanding them.

( I have changed)