Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git pushing to remote branch

Tags:

git

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

  1. git add .
  2. 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.

like image 830
Em Ae Avatar asked Mar 21 '16 18:03

Em Ae


People also ask

How do I push to a remote branch?

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.

What is git push remote?

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.

Does git push push to all remotes?

Running git pushall will now push all branches to all remotes. Git allows you to make that call into a custom command.


1 Answers

Simply push this branch to a different branch name

 git push -u origin localBranch:remoteBranch 
like image 54
George Chen Avatar answered Oct 02 '22 16:10

George Chen