April 19, 2020 • ☕️ 1 min read
Setting the default upstream for a git repo is simple. Git has a
-u for short) flag that allows us to set where git will push by default.
The syntax for this is as follows.
git push -u <remote_name> <local_branch_name>:<corresponding_remote_branch_name>
# Example git push -u origin master:master
We can shorten this if the remote’s branch name is the same as what it is locally.
git push -u <remote_name> <local_branch_name>
# Example git push -u origin master