Search code examples
gitgithubphpstorm

Can't update project to a specific branch


So this is likely a software problem, but I think its just me misunderstanding things so I'm asking here.

I'm doing a project with multiple people for the first time and doing a github project.

As I'm understanding it, branches are just different versions, so I wanted to do a development branch and use the master branch for the finished product.

Now I can't figure why I can't update my workspace with the content of the branch. For testing I just made two different readmes in each branch. Works fine, I can just pull to get the files from the master branch.

I did all of that using the inbuilt VCS tools in PhpStorm.

So now I created the new branch (development) locally, fetched everything from the remote repo and then set up the local branch to track the remote branch with

git branch --track development origin/development

If I understood everything correctly, I should now be able to pull everything from the branch, right? Keep in mind I still have the master readme in my workspace, but when I pull or try to commit changes it tells me there are no changes every time, although the readmes are clearly different.

Am I doing something wrong or misunderstanding something?


Solution

  • First of all start by reading about Git flow which will suit your need to develop and use master for production.

    To understand more about branches read this question:


    Now I can't figure why I can't update my workspace with the content of the branch

    You will need to merge your branch (the one which you developed on) into the current branch.

    git pull <my other branch>
    

    This will "update" your current branch with the content of the second branch.


    ... If I understood everything correctly, I should now be able to pull everything from the branch, right?

    The simple answer is yes. but it would be better if you continue developing on a separate branch and once in a while pull the content of the development branch into your current branch instead of changing it tracking branch.