简体   繁体   中英

Create repo into git and sincronize with bitbucket

I have created a project in bitbucket where I have the "master" branch but I would like to work in the "develop" branch that does not I have it created.

Go doing doing the features there and when you have a stable version pass it to the master branch.

The steps that I have taken when creating the project have been these

Step1 - Start the git project, inside my project with the command "git init"

Step 2 - Initial Commit

Step 3 - Tell my local git which is remote repositiro with the command git remote add origin https: //user@bitbucket.org/pepe1234/project_test.git

And finally this command "git push origin master"

With this I want to understand that all the commits that I make to my branch "develop" in local, when doing a push should go up to the bitbucket repository, not ????

If I run the command "git remote -v" I see this

C: \ xampp \ htdocs \ test> git remote -v
origin https: //user@bitbucket.org/pepe1234/test.git (fetch)
origin https: //user@bitbucket.org/pepe1234/test.git (push)

First you need to create and checkout the develop branch- You can do this in 1 step

git checkout -b develop

Your remote setup looks good. Once you make some changes you can add and commit them to the develop branch:

git add <changedFiles>
git commit 

Once you have your changes committed.. you can push the develop branch to bitbucket

git push origin develop

At this point to get your code into master you have 2 options. You can use the command line or the bitbucket web interface.

If you want to merge your changes into master branch from the bitbucket web interface you can create a pull request from the left nav bar. You can select your develop branch on the left, and master on the right. After the pull request is created, merging it will merge your code changes into master.

If you want to merge from the command line, you can simply run these commands

git checkout master # checkout the master branch since we've been working on develop
git merge develop
git push origin master

The first option is recommended in my opinion especially if oyu are working with other folks as everyone can see what's being merged and can leave comments, etc.

HTH

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