In some branch I made some changes, but didn't add them to the index.
Next I checked out a new branch to track a remote one and saw that the changes made while working on the first branch where still there. I would have expected them being discarded because now the local branch doesn't reflect the state of the remote branch.
Ok, but the problem is SourceTree has no option in de Checkout New Branch tab to discard/cleanup changes.
Git won't discard uncommitted files unless you explicitly tell it to. If the files that you changed are identical between the two branches (besides the uncommitted changes), Git will allow you to switch while keeping the changes (useful if you realized you were making the changes on the wrong branch, or just created a new branch for changes you were creating).
New files will always be kept as well, and Git should only complain if you try to check out a branch that has an indexed file with the same name/location.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.