Search code examples
gitatlassian-sourcetree

SourceTree - Checkout new branch from remote on current commit


Here is the process I would like to use to create a new feature in a git rep

  1. Create the feature branch on remote (with JIRA) starting from develop
  2. Fetch locally the remote branches
  3. Checkout the new feature branch locally with SourceTree
  4. Start working

Unfortunately, the 3) step is very annoying to do with SourceTree. The branch develop has already been checkout, therefore when I double-click, on the last commit (that is the end of two branches : develop / newFeature) it automatically checks out develop and does not ask me if I want to checkout the newFeature branch Here is an example of commit that cause pb: double clicking on it only checks out develop

I had to replace 3) by

3a) Delete develop locally

3b) Double click on the commit, because none of the two branches are checkout, SourceTree asks me which one to choose, I get the newFeature one

3c) After my first commit on the newFeature branch, I can checkout develop again because they do not share the same end anymore

I am sure there is something cleaner, is there a special tool that I do not know about ?


Solution

  • I found the solution of this, to checkout a specific branch on a commit with two tags you need

    If the branch has not been checked out locally: Go on your remote (left Pane) and double click on the branch you want to checkout locally

    If the branch has already been checked out : Go on the Branches (left Pane) and double click on the branch