简体   繁体   中英

git: pulling a certain branch from private git server repo and pushing it to BitBucket repo

I am involved in a project working with a team of developers located in another country.

They have their own .git server. They only granted me read access (I can pull, but no push).

I have a Bitbucket account where I pushed the code as well. I added this as a [remote “myBBaccount”] in .git/config file.

If I want to make a change, I push my changes to Bitbucket and send them a pull request. They will then pull from my Bitbucket account. They want to use this setup as it is safer for them apparently.

I usually do a git pull , do my work (usually on master branch, I know, not the best idea) and then do a git push myBBaccount .

But recently, they asked me to pull develop branch instead of master. They have multiple branches on their repo. I am not sure how to deal with this new workflow.

Should I just do a git branch –a to see all the branches on my machine, and then git checkout develop , work on that and just push using git push myBBaccount ? I am not sure this is the way to go. Should I do any merges?

I am using git 2.0.4.

If you use recent enough version of git (>1.9 should do), git checkout develop should indeed create a new local branch named develop tracking the remote branch (ie origin/develop ), and then you would push as you said (again, check your version of git - old versions did some surprising things when pushing).

As for merging, it depends on what the team wants from you. If they just want you to make some changes on develop and submit them, you don't do any merging.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM