Unfortunately with Tortoise, this is one of the LEAST straightforward features I have found (it is easier in OTHER Git clients, but not in Tortoise). This is especially true if you have merged changes from a branch that you don’t need to keep anymore. Lastly, you’ll want to occasionally delete a branch. As the merge will only have happened on your local repository, not on the remote repository. You can simply grab the changes directly from the remote repository (AKA the server, AKA GitLab).Once you have successfully merged, you may need to commit and push these changes. Note that the remote versions of these branches are also selectable, this is because you can merge directly from your server, meaning you don’t have to Pull changes to your local branch, or even have the branch on your machine in order to merge.
Go to TortoiseGit > Switch/Checkout to make sure you are on the branch that wishes to RECEIVE changes.To make this magic happen, follow these steps: This process will take differences from another branch, and apply them to whichever branch you are currently working on. So, what if you LIKE the changes on development, and feel like you need these same changes on the master branch? Then, you need to merge your branches! Merge a branch Hopefully, the above GIF demonstrates how branches are copies of your project, but with slight differences. Only the development branch has the 3 extra text files, but when we switch to the master branch, we can see that those files do not exist on master. In the above GIF, you can see what my project folder looks like when I switch branches. Some files have been created on the development branch, committed and then pushed. So, now that you have a new branch, you can do THIS magic:ĭid that not seem magical? Let me explain. Not a necessary step, but this way you know for sure that the branch you created is accessible from places outside of your own computer. But here’s what mine looks like on GitLab:
#Git create branch from remote branch how to
I won’t tell you how to do this, because I bet you can figure it out.
If you have used GitLab as your server, like I suggested in Getting Started, then for your own peace of mind, you can also confirm the existence of your new branch by logging in to your GitLab account, clicking on your project, and viewing your branches. If you’ve followed my setup guide correctly, Getting Started with Tortoise Git for windows, then this should have worked successfully, with blue text, NOT RED: Note that this is identical to trying to push when you have committed your work. You need to push this new branch to the remote repository. To do that, go to TortoiseGit > Push. When the dialogue appears, simply push the OK button. Your team members can’t access it, and if you try to work from a different computer, neither can you! But this branch still only exists on your local repository. Remember, we have created a new branch, and even switched to it. Push is simply what you do to take changes on your local repository (on your coputer) and push those changes to your remote repository (like gitlab). That’s not what push means when we are talking about git. Go to TortoiseGit > Switch/Checkout and in the dialogue, select your new branch. Your branch exists, but we aren’t using it yet.
#Git create branch from remote branch professional
Note that professional practice would instruct that your first new branch should be named development, with the expectation that you then make a new branch from development to work on. When the dialogue appears, simply type a name for your new branch, and hit the OK button.This would mean I want you to right-click at the top-most folder of your git project in windows, and go to your Tortoise Git menu, and select Switch/Checkout. I will simply type the shorthand version, such as “Go to ToirtoiseGit > Switch/Checkout“. I expect you to know how to do this already. To keep the text shorter, I will not be instructing you to right-click for bringing up your tortoise menu. Now, assuming you’re familiar with branching, I’m going to go ahead and show you how to do the following things with branches in Tortoise Git: If you’re new to branching, please make sure you’ve read that first. It is explained in my guide: ‘ What are ‘branches’?‘. Before reading this, I hope that you understand what you are trying to achieve with branching.