Search code examples
gitgit-push

Git push is set 'upstream' in conf, but want to use 'matching' occasionally


I recently switched to upstream for my git push configuration (meaning only the current branch will be pushed to its upstream counterpart), to avoid unexpected things being pushed. However, there are some times I'm sure I want to have the default push behaviour (being matching), and push all branched to their matching counterparts. How can I achieve that without changing my configuration ? I've seen git push can have an --all options, but it looks like it pushes all branches. As I cannot test it right now, I'm turning to you guys.

Thanks for your time!


Solution

  • Why can't you just do git push origin branchname or set an alias for that and keep doing that without changing any configuration? That way your git push will remain the normal default.