Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

push an 'unchecked out' branch

Tags:

git

I want to push a branch (not the current) without having to check it out first, how can I achieve that ?

this is how I'd do:

#currently in master git checkout feature git push origin feature git checkout master 

but checking out feature can cause conflicts, can't I just push another branch than the current one ?

like image 940
BiAiB Avatar asked Nov 27 '12 11:11

BiAiB


People also ask

How do I push a branch to check out?

The "push" command is used to publish new local commits on a remote server. The source (i.e. which branch the data should be uploaded from) is always the currently checked out HEAD branch. The target (i.e. which branch the data should be uploaded to) can be specified in the command's options.

What happens if you push to a deleted branch?

What happens if I push the way it is? If you git push , it will simply re-create the old branch name on the remote. If you hadn't renamed your branch this would likely be fine assuming you intended to re-use the same branch name, but since you renamed your branch, this is undesirable.


1 Answers

Simply:

git push origin feature:feature 

Or shorter:

git push origin feature 
like image 68
trojanfoe Avatar answered Sep 29 '22 11:09

trojanfoe