Working with master branch and new branches in git

Hi - I have Git set up using BitBucket and have set site up locally using Mamp. I’ve pushed the completed site to bitbucket and deployed no problem.

I now need to make a new feature and obviously want to create a new branch to build the feature on and then merge it back.

Can I pull the branch down to my local copy and overwrite it or do I have to work in a new local folder and then change the set up in Mamp to view and work on it?


Sounds like you did it backwards. You should have created the branch on your local copy and then pushed that to bitbucket if you wanted it on there. Nevertheless, if you created a branch directly in bitbucket, you can pull it into your local copy but you may have merge conflicts if you also created the branch on your local copy and it is not in sync with the remote copy. There is no need for additional local folders to work out of. You should never have to change the mamp settings in regards to using git. If you created an empty Branch directly in bitbucket and have not done any thing locally, I would just delete the bitbucket branch and create it in your local project and then switch to that Branch to work on it. You can then push it to bit bucket from there if you want.

Thanks - I haven’t done anything yet. Just been working on the master copy.

So if I have this correct I should do the following.

1: On my local copy in terminal create a new branch for the feature.

2: check it out and make the changes, test etc

3: when ready, merge it to the master

That sound right?


Yes, you got it. Optimally, you should have a development Branch as well instead of working directly on the master. The master should be where your versions are that are production ready for release. That is known as the git flow workflow. There are other standard workflows. It wouldn’t hurt to learn about them.


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.