.gitconfig magic

Since I mostly want to push to an origin that's the same as my current branch, I can do that easily with:

git push -u origin <my_branch>

There's a also a config for that.

Add these lines to your .gitconfig, that's located in your home directory:

[push]
        autoSetupRemote = true

After that you can simply use:

git push

And you don't have the need to write the boilerplate.

Or just use a oneliner for it:

git config --global push.autoSetupRemote true

More tips here

https://blog.gitbutler.com/how-git-core-devs-configure-git/

All articles


Comments

No published comments yet.


Add a Comment

Your comment is held for review before it appears publicly.

Your email is never published or shared.

Up to 2,000 characters.

Tick the box, then click Submit right away (Google expires the check after about two minutes).