Reputation:
The remote repo has master and staging branches, and I am only supposed to work in staging. The first thing I did was clone the repo down to my local computer. Then I used git checkout -b form origin/staging
to create and checkout a new local branch and have that track the origin/staging
remote.
Now I have several commits and am ready to push that to the staging. How do I do that? Can I simply type git push? If I did that, will it just push my commits into the staging branch on the remote or will it create a new branch called forms into the repo which is not what I want.
Upvotes: 1
Views: 885
Reputation: 21803
You can use:
git push repo_name from:to
So for your case:
git push origin form:staging
You could need to update your code before:
# will update merging
git pull
Or:
# will update rebasing
git pull --rebase
For a difference between rebase and merge check this.
You could also pass your changes in form
to staging
local branches:
# to change local branch
git checkout staging
# to get changes from form branch in staging branch
git merge form
# to push corresponding branch
git push
This way you won't have to give a refspec from:to
Upvotes: 1