Feature branch workflow in sourcetree

Trying to follow the Feature branch workflow as described by Atlassian at https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow from within Sourcetree.  I'm fine up until it comes time to pull the feature branch from origin into master.  If I do this in Sourcetree I get the warning: Are you sure you want to pull from a non-tracked branch?  If I just do the git pull from the command line everything proceeds without any issues.   Is Sourcetree being more strict than my command line git or is it actually doing something different?  Here are some screenshots.  My feature branch is called second-test.

Screen Shot 2015-06-04 at 10.53.47 PM.png

 

Screen Shot 2015-06-04 at 10.54.56 PM.png

3 answers

1 accepted

0 votes
Accepted answer

Additionally, what the warning is trying to tell you is that you are pulling a branch directly from remote, rather than one of your local branches. If the branch is one that you don't have checked-out (tracked) locally, then it's more difficult to review the contents of the branch to be sure you want it merged in.

The tutorial says to use "pull" from remote instead of "merge" (potentially with the local branch) because it "makes sure you’re always pulling the most up-to-date version of the feature branch". If you are merging in a feature branch that you are working on alone, there is no risk of being out-of-date, so you can avoid the warning by merging the local feature branch instead of pulling the remote feature branch.

As you can see I using pull both in Sourcetree and from the command line as the tutorial recommends. The tutorial specifically says to pull in the feature branch from origin which is what I do here. This portion of the tutorial is under "Mary publishes her feature" and the commands described are: git checkout master git pull git pull origin marys-feature git push With the exception of the name of my feature branch I believe I am doing the exact same thing in Sourcetree and it certainly works as expected from the command line. I guess my bottom line is I find it odd that Atlassian wrote a tutorial that their software says is not recommended behaviour.

Well I'm still surprised that Sourcetree software advises against behaviour that they seem to advocate for, yours is certainly the correct answer.

SourceTree is doing the same thing (you can check the cmd output once you actually run this), but it warns you that you are potentially doing something else than what you wanted. If this is something you repeatedly do, check the "Don't ask me again" checkbox.

I think it is odd that Atlassian wrote a tutorial including behaviour that their software warns against. I'm aware I can make the warnings go away but I want to understand why a workflow they recommend on their website throws warnings in their software. I assumed I missed a trick in Sourcetree early in the workflow but it now seems that is not the case.

Since your current branch is master , when you do a git pull from command line, you are getting the latest from origin/master -> master

 

But in sourcetree ,assuming that master is still your current branch, you are trying to  pull from origin/second-test ->master (as per your screenshot) ,which is why sourcetree gives you that warning.

You can see the in my first screenshot the command-line pull I ran is: git pull origin second-test Making it identical to what I did in Sourcetree.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

736 views 3 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you