What is git push -- set upstream origin branch?
Git push is a handy tool that allows you to keep your branches in sync. By setting the upstream origin branch, you can ensure that your local changes are always pushed to the remote repository. Here we will learn how to set up git push so that it pushes to the correct branch every time. When we use the command git push, our local changes are pushed to a remote repository. If we don't specify a branch name, the default behavior is to push our changes to the master branch. However, if we have not yet set up a tracking relationship between our local master branch and the remote origin/master branch (a.k.a "upstream"), then git will refuse to push our changes.
git set upstream
git branch --set-upstream-to <remote-branch>
// example
git branch --set-upstream-to origin feature-branch
// show up which remote branch a local branch is tracking
git branch -vv
// short version to set upstream with very first push
git push -u origin local-branch
github set branch upstream
git push --set-upstream origin <remote-branch>
There are a few things you need to do in order to set up your repository. We've walked you through the process step-by-step so that you can get started using Git with ease.