I'm remotely connected to the git project from the GIT Bash, while switching between the branches I'm facing the error
error: The following untracked working tree files would be overwritten by checkout:
Please move or remove them before you can switch branches.
And when I'm doing the "git status", it shows the local desktop changes not the project changes
nothing added to commit but untracked files present (use "git add" to track)
What should be the approach to to resolve this issue?
Solved! Solved! Go to Solution.
Welcome to the Github Community Forum!
The error shows you the file that prevent you from checkout, that file is in the dirty form in that branch so you need to change his form by move it to staged area or delete the changes made to that file.
To move to staged area you need to add that file and commit:
git add .gitconfig git commit -m 'Update (.gitconfig)"
To delete changes made to that file you need checkout that file:
git checkout -- .gitconfig
The untracked files are the files that are not in the history yet. If you don't want this files in the history you can add them to the .gitignore file, for example you don't want the eclipse metadata you need to add the .eclipse directory into gitignore file:
And this resolve all your problem.
Suggestion: you're trying to add your entire home to a git repository, be carefull with the dimension of what you push.
Mark helpfull posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great contents!