deployment - Create a script to git pull/checkout from specific branch -


i'm trying write script deploy our webapp git. have 2 servers ("production" , "development").

i've made new develop branch, , after first clone on server situation git branch -a this:

* master   remotes/origin/head -> origin/master   remotes/origin/develop   remotes/origin/master 

i'm trying write simple script pull master on production server, , develop on development server.

after clone did

git pull origin develop git checkout develop 

and situation this:

* develop   master   remotes/origin/head -> origin/master   remotes/origin/develop   remotes/origin/master 

the files matching develop branch. far good.

i've tried same master:

git pull origin master git checkout master 

and got message:

your branch ahead of 'origin/master' 5 commits.   (use "git push" publish local commits) 

and files seems same of develop.

i guess knkowledge git , local/remote branch not enough, i'm missing something.

try other way around :

git checkout <branch> git pull origin <branch> 

calling git pull origin master wil execute following 2 actions :

  • get changes remote branch master
    (you can achieve same thing running git fetch origin master)
  • merge active branch origin/master
    (you can achieve same thing running git merge origin/master)

so, if active branch develop, running git pull origin master move local develop branch.
then, running git checkout master checkout local master branch without updating it.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -