How to Automatically Set an Upstream Branch in Git

How to Automatically Set an Upstream Branch in Git

Git Tip:
Skip --set-upstream! Set the upstream branch automatically using the push.default config. Heres an example:

# Before: Manually setting upstream
git push --set-upstream origin apples

# Configuration to set upstream automatically
git config --global push.default current

# After: Just push, and Git sets the upstream automatically
git push

Subscribe to our newsletter and stay updated.

Don't miss anything. Get all the latest posts delivered straight to your inbox.
Great! Check your inbox and click the link to confirm your subscription.
Error! Please enter a valid email address!