Steps taken
I merged a feature
branch back into master
and deleted the feature
branch. But it still shows up in the tree.
Result
Tree visualisation in SourceTree before deleting the feature branch:
Tree visualisation in SourceTree after deleting the feature branch:
The feature
branch in the left-hand list is gone, as expected, and the label in the tree visualisation is gone as well, again as expected.
Questions
But:
- Why is the violet part still shown?
- Which Git commands would I have needed to execute to not see the violet part anymore? I probably answered this question myself two sections further down.
I understand that the final commit in the screenshot above has two parents.
But I don't understand why the violet commit which happened on the feature branch is not inside the final merged commit on master
(which would, I think, mean that the violet branch shouldn't be visible anymore after deleting it).
Replay of steps from the command line (instead of SourceTree)
I replayed it on the command line (just to check whether SourceTree did what I thought it did) and the final step was a git merge feature
. Same situation:
Trial with --squash
I undid the last merge and tried this:
git merge --squash feature
git commit "Squashed merge"
git delete -D feature # Note that -d did not work; it said "error: The branch 'feature' is not fully merged."
And now it shows what I would have expected in the first place. One straight line and no indication of the feature
branch ever existing:
Question
- How is this merge different from the previous merge?
I guess I sort of pieced together what happens with those merges after all the trial and error above, but I would be grateful if someone could really explain in detail what the semantic difference of the above steps are.