1

How to do Push / Pull works automatically with the other branch of remote repository? By default, created a "master". I added "develop". I want everyone to have worked with develop. :-)

HammerSpb
  • 725
  • 1
  • 12
  • 25

1 Answers1

2

If you have created a branch named "develop" on the remote repository, everyone that clones this repository will have a reference to this branch, e.g. "origin/develop", if the alias for the remote repository is "origin".

So if I cloned this repository and wanted to work against the develop branch on the remote repository, I'd create a local branch named "develop" that's tracking "origin/develop". This can be done in various ways and with different syntax, but I prefer:

git checkout --track origin/develop

I can now edit and commit files to my local develop branch and do "git pull" and "git push" to sync with the remote branch.

If you already have a local branch named develop, which is not a tracking branch, you can set it up with the following command:

git branch --set-upstream develop origin/develop

Hope this helps!

rtn
  • 127,556
  • 20
  • 111
  • 121