I'd like to use just:
git push
or at most:
git push origin
rather than having to first check which is the active branch with git branch --list
, then type:
git push origin <branch>
Here and here I've seen that if I do this once:
git push -u origin <branch>
then from then on I can use just git push
for that branch. However, I don't want to do this "setup" step for each branch, because it's extra work that I also may forget to do.
Why is this "setup" step necessary and can I avoid it?
Also, if I do the "setup" step (push -u
) for a branch that doesn't exist yet (neither on my PC nor on the server), does that remove the need to do git checkout -b <branch>
first?
Related post: Almost the same question has been posted here but it doesn't ask for a way to do away with the requirement, it only asks why the requirement is there.