When I press Ctrl+D for a file located it the area "Unstaged files" or "Staged files", an external diff tool is open where the file before my changes is shown on the left pane, the file after my changes on the right pane. However, when I do the same for a "stashed" file, the file before my changes is shown on the right panel and the file after my changes on the left panel. Why a distribution of the files between the panes in this case is different? Is this a bug?
// SourceTree version 3.4.17
Hi @Jordan
Welcome to the Atlassian Community!
This behavior may seem backward because, when diffing a stash, Sourcetree compares the stash commit to your working directory or to your base commit. Because Git structures stashes, Sourcetree interprets the stash as the baseline (left) and your changes as the modified state (right), reversing the usual order.
To see your changes in the traditional left-to-right order, you can review the stash directly in Sourcetree's preview pane, or apply it to a temporary branch for a normal diff and then discard it if needed.
Thanks for the explanation. However, I think my question was slightly different.
I understand that a stash has a special internal structure and that diffing a stash may not be exactly the same as diffing unstaged or staged changes.
What confuses me is the order in which Sourcetree passes the two file versions to the external diff tool.
For unstaged or staged files, the external diff tool shows the original/base version on the left and the modified version on the right. But for stashed files, the order is reversed: the modified/stashed version is shown on the left, and the original/base version is shown on the right.
So my question is not only why stash diffs are different internally, but why the external diff tool receives the file versions in the opposite left/right order. Is that intentional behavior, or is it an inconsistency/bug in Sourcetree?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.