I'm new to git and SourceTree. We plan to use git in our new project with git flow. I tested features of SourceTree and have one question.
When I start a new feature, make one commit and finish the feature - history looks linear - as if I simply committed to the develop branch. But when I start a feature, make two or more commits and finish it - then the history shows branches from develop.
Is it behavior correct or did I miss something? I tried the same thing with another git tool and got expected results. I prefer SourceTree however and want to solve this issue.
# merge into BASE git_do checkout "$DEVELOP_BRANCH" if [ "$(git rev-list -n2 "$DEVELOP_BRANCH..$BRANCH" | wc -l)" -eq 1 ]; then git_do merge --ff "$BRANCH" else if noflag squash; then git_do merge --no-ff "$BRANCH" else git_do merge --squash "$BRANCH" git_do commit git_do merge "$BRANCH" fi fi
But I have no idea why there is this "if" with fast-forward and without fast-forward.
This sounds like a simple case of a fast forward commit which means your commit is directly upstream of the branch. The git-scm docs explain it well:
You’ll notice the phrase "Fast forward" in that merge. Because the commit pointed to by the branch you merged in was directly upstream of the commit you’re on, Git moves the pointer forward. To phrase that another way, when you try to merge one commit with a commit that can be reached by following the first commit’s history, Git simplifies things by moving the pointer forward because there is no divergent work to merge together — this is called a "fast forward".
A fast forward commit is the default in SourceTree because in those cases there's usually no need to have a branch history like that, it may as well be linear. You can turn this off though from within SourceTree by turning the checkbox "Create a commit even if merge resolved via fast-forward" from the merge sheet.
Hope that helps
Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...
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!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot