SourceTree - error while checking out commit

Hi,

I’m using source tree to get to speed with the course.
Until this commit everything works well enough.

And then, after that

I’ve got this error

error: The following untracked working tree files would be overwritten by checkout:

How to fix it?

The times I’ve seen this, it’s because I have uncommitted changes against the current HEAD.

First things first, Stash any changes on your current HEAD or “revert” to the prior commit (discard the changes).

Then, with no uncommitted changes active, you should be able to switch to the checkout you wish. If you’re going to edit anything, it’s better to create a new (local) branch at the commit than to check it out. You can then commit these changes against the local branch and switch without issues.

Git will always complain if you try to leave changes on the table.

1 Like

Thanks, unfortunately stashing, reverting and branching at this point gave me more errors. I deleted project and cloned it again. Now I can do new branch and make my own commits, and check out other commits without errors. I will remember to do that in future. Thanks!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms