I tried to follow this post but got confused rather than getting my problem solved.
Here is the scenario.
I have created a branch like git checkout -b <branch_name>
. I then worked on some changes and did
git add .
git commit -m "comment"
Now all those changes are in my uncommitted local <branch_name>
branch. What i want to do is to push these changes upstream but i want to push it to a branch which doesn't exist e.g., <branch_name>_test
I don't want to push it to my <branch_name>
. How can i do so.
In order to push your branch to another remote branch, use the “git push” command and specify the remote name, the name of your local branch as the name of the remote branch.
The git push command is used to upload local repository content to a remote repository. Pushing is how you transfer commits from your local repository to a remote repo. It's the counterpart to git fetch , but whereas fetching imports commits to local branches, pushing exports commits to remote branches.
Running git pushall will now push all branches to all remotes. Git allows you to make that call into a custom command.
Simply push this branch to a different branch name
git push -u origin localBranch:remoteBranch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With