Using SourceTree when I try to switch back to master from a feature branch I created I get an error:
Updating the following directories would lose untracked files in it
I want to switch back to master to make another feature branch but am unable to do so.
Actually figured this out myself. By using the terminal in SourceTree, I entered the following command:
git checkout -f master
The -f flag forces it to switch even if there is an error. It still showed the error before switching but it did switch and I was able to make a new feature branch.
Make sure your file is added to the index
git add <filename>
Then:
Commit your changes
git commit
Or stash them
git stash
You can access the stashed changes later by this:
git stash pop
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With