Set a Default Push Remote with git
During my early days of git usage, my config allowed me to simply type git push
instead of git push {origin} {branch_name}
which I need to now. Up until recently I needed to type out the long version...(I know)...which was incredibly annoying because I like using detailed branch names.
I'd finally had enough of the copy and paste branch name madness and decided I wanted git push
to always push to my origin and the same branch name:
git config --global push.default current
There are a number of push.default
values you can use but in most cases, especially when you have a GitHub workflow, current
is likely the value you want to use. Also, since we're using --global
, this will be the default for all repositories!
Before we get started, it's worth me spending a brief moment introducing myself to you. My name is Mark (or @integralist if Twitter happens to be your communication tool of choice) and I currently work for BBC News in London England as a principal engineer/tech...
My team mate Edna Piranha is not only an awesome hacker; she's also a fantastic philosopher! Communication and online interactions is a subject that has kept her mind busy for a long time, and it has also resulted in a bunch of interesting experimental projects...
Before we start, I want to say thank you to David for giving me this awesome opportunity to share this experience with you guys and say that I'm really flattered. I think that CSS animations are really great. When I first learned how CSS...
When I first wrote MooTools ElementFilter, I didn't think much of it. Fast forward eight months later and I've realized I've used the plugin a billion times. Hell, even one of the "big 3" search engines is using it for their maps application.
Thanks for sharing, David. That’ll save me considerable time.
Love this one ! Thank you for sharing.
For anyone who doesn’t want to set it local, you can also do git push origin –set-upstream per your local branches: https://git-scm.com/book/en/v2/Git-Branching-Remote-Branches
How do you set the default for pull? For an open source fork I have, I want
git pull
to default togit pull upstream special-dev-branch
?I’d second Devin Rhode’s question