Hello. I installed git, and on my master branch I have all my folders from my PC. How can I remove them from under the gita please tell me

On branch master Untracked files: (use "git add <file>..." to include in what will be committed) .bash_history AppData/ Contacts/ Desktop/ Documents/ Downloads/ Favorites/ IdeaProjects/ Links/ Music/ NTUSER.DAT NTUSER.DAT{39b0c0d2-7aed-11e6-af82-967153cd1394}.TxR.0.regtrans-ms NTUSER.DAT{39b0c0d2-7aed-11e6-af82-967153cd1394}.TxR.1.regtrans-ms NTUSER.DAT{39b0c0d2-7aed-11e6-af82-967153cd1394}.TxR.2.regtrans-ms NTUSER.DAT{39b0c0d2-7aed-11e6-af82-967153cd1394}.TxR.blf NTUSER.DAT{39b0c0d3-7aed-11e6-af82-967153cd1394}.TM.blf NTUSER.DAT{39b0c0d3-7aed-11e6-af82-967153cd1394}.TMContainer00000000000000000001.regtrans-ms NTUSER.DAT{39b0c0d3-7aed-11e6-af82-967153cd1394}.TMContainer00000000000000000002.regtrans-ms OneDrive/ Pictures/ Saved Games/ Searches/ Tracing/ Videos/ YandexDisk/ ntuser.dat.LOG1 ntuser.dat.LOG2 
  • 3
    A simple solution is to create a repository in a separate folder, and not in the user's home folder (that is, create a folder, go to it, execute git init in it). - insolor
  • Thank you so much) - GreenWhite

1 answer 1

Judging by the Untracked files in the output, the files and folders not yet under git: git are suggested to use git add to add them there. And since they are not added, then there is no problem.

There are two ways

  1. A git repository was accidentally created in an unnecessary folder. If all the files and folders were not committed and there is a need to get rid of this local repository, then try to delete the hidden folder. .git , should be located in the same directory as those listed in the question text of the folder.

  2. If the repository in this place is needed, and many folders are not, then .gitignore them to the .gitignore file. Create a .gitignore file in the same directory with content, for example

     AppData/ Contacts/ Desktop/ Documents/ Downloads/ Favorites/ IdeaProjects/ Links/ Music/ *.pdf NTUSER.DAT* 
  • Why delete? Just move to a separate directory, and then git reset --hard , but the files of the working directory really need to be cleaned, but git ls-files will easily help with this. - 0andriy