Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git - push to a remote-tracking branch in the remote repository

Tags:

git

branch

push

When simply doing git push to a remote repository, its master branch gets updated. This is undesirable in the case of non-bare repositories, and the warning message displayed by recent Git versions makes that clear.

I'd like to be able to push to a remote repository, and have one of its remote tracking branches be updated. Later, when I log in to the remote machine and run commands, I can choose to merge that remote tracking branch into master.

How can I do that? Or is there a better way to push changes to a non-bare repository?

like image 857
Alex Morega Avatar asked Oct 15 '22 10:10

Alex Morega


1 Answers

You can do:

git push master:some-remote-branch

for example:

git push master:alex/master

(Although it is still not recommended to push to non-bare repository.)

like image 128
silk Avatar answered Oct 17 '22 13:10

silk