Git Noob Tips
Push Default Branch
🗓️ Published: 6/3/2022
Let's say you created a new branch locally, named my-fantastic-branch, and you want to push it to the remote repo. The first time you're pushing, you need to specify the name again and instruct git that this is your "upstream" branch from now on so that git creates the branch on the remote repo:
git push --set-upstream origin my-fantastic-branch
This is usually tedious and prevents people from using descriptive branch names. To avoid this and set the remote branch to have the same name as the local one by default:
git config --global push.default current
Next time on push, there is no need to repeat yourself.