Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I push a specific branch of Git to my server?

Tags:

git

I'm working to deploy a Django app. The app built on a Github OS project. I have this stored locally as the Master branch.

$ git branch    * master     customized - customized with local dev settings     webfaction_customized - with production server settings  

The customizations for this project are stored in 2 separate branches.

My plan was to perform my customization locally in 'customized', then merge those changes into 'webfaction_customized'

Then push these changes to a bare repository on the production_server: I would then clone this bare repository on the production_server, change the settings in the cloned repository and restart the fcgi process.

The first problem was that I found this if I tried to push a branch to the server that wasn't master, I could not clone from the bare repository.

So I tried to push the master branch to the server.

git push webfaction_server master 

But now I'm finding that none of my branches are uploaded.

Is there some way to push a specific branch to a bare repository and be able to clone that branch?

OR

Do I need to restructure my project so that Master branch is my customizations and the Github project would be in a github branch?

like image 586
BryanWheelock Avatar asked Dec 22 '09 17:12

BryanWheelock


People also ask

How do I deploy a specific branch in git?

To where you wish to deploy. Run git checkout -b deployment origin/master . Make your changes (push them if you like). Whenever your master (or whatever branch you made the deployment from) has changes you want to deploy, simply git pull --rebase .

How do I push a new branch to a server?

Create a new branch with the branch, switch or checkout commands. Perform a git push with the –set-upstream option to set the remote repo for the new branch. Continue to perform Git commits locally on the new branch. Simply use a git push origin command on subsequent pushes of the new branch to the remote repo.


1 Answers

You would simply do:

git push origin webfaction_customized 

Where origin is your remote name and webfaction_customized is your custom branch.

Hence, when you work on the master branch, you are pushing via:

git push origin master 
like image 139
askilondz Avatar answered Sep 23 '22 20:09

askilondz