In Visual Studio Code I made some changes which I do not want to commit en sync yet. However, after my holiday, I want to sync the files from the server (changes from my colleagues). So In Visual Studio Code I want to do a sync.
I get a message "Please clean your repository working tree before checkout"
What do I need to do to get the files of my colleagues without losing my own uncommitted changes?
Th Working Tree in Git is a directory (and its files and subdirectories) on your file system that is associated with a repository. It's full of the files you edit, where you add new files, and from which you remove unneeded files.
In my experience the best way to stash the changes is like so:
sync the changes from your co-workers and afterward do stash-pop like so:
You may also perform these actions in the terminal:
git stash
git stash pop
Create a temporary branch and commit the changes. Or if you don't want to create a temporary branch - stash the changes.
Not only should you stash, but VSCode 1.52 (Nov. 2020) will be even safer with:
Git: Prompt to save files before stashing
VS Code will now prompt you to save unsaved files whenever you attempt to stash changes.
in my case I had free working tree but VC code still say 'Please clean your repository working tree before checkout.'. I used git push -f origin
to force push to origin. Maybe it will helps for someone!
for my case i simply had unstaged a file i went back and selected the file on my terminal and staged the file and i was free and ready to merge and commit
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