That will almost work.
When pushing to a non-default branch, you need to specify the source ref and the target ref:
git push origin branch1:branch2
Or
git push <remote> <branch with new changes>:<branch you are pushing to>
More Related Contents:
- How do I rename a local Git branch?
- Move the most recent commit(s) to a new branch with Git
- How do I push a new local branch to a remote Git repository and track it too?
- Move existing, uncommitted work to a new branch in Git
- How do you create a remote Git branch?
- Git fetch remote branch
- What is the best (and safest) way to merge a Git branch into master?
- Showing which files have changed between two revisions
- Why do I need to do `–set-upstream` all the time?
- How to fetch all Git branches
- Remove tracking branches no longer on remote
- Cleaning up old remote git branches
- Show just the current branch in Git
- Git: Find the most recent common ancestor of two branches
- Using Git, show all commits that are in one branch, but not the other(s)
- Git branching: master vs. origin/master vs. remotes/origin/master
- Git branch command behaves like ‘less’
- How to restrict access to the master branch in Git
- How do I clone all remote branches?
- How do I fetch all Git branches?
- How do I remove local (untracked) files from the current Git working tree?
- How do I merge changes to a single file, rather than merging commits?
- Git merge hotfix branch into feature branch
- Find out a Git branch creator
- Git Diff of same files in two directories always result in “renamed”
- Git branch name – case sensitive or insensitive?
- How to keep a branch synchronized/updated with master?
- Git: Merge a Remote branch locally
- Why call git branch –unset-upstream to fixup?
- Git: How to list commits on this branch but not from merged branches