-1

i have been battling with trying to get rid of the untracked files showing up when i git status on my git bash terminal,it has also affected my whole computer system as i usually see different files as well as files added to the ones i intend to push to my github repository. please i need help fixing it.

  modified:   ../../FrontEndMentorsChallenges/intro-component-with-signup-form-master/index.html
        modified:   ../../FrontEndMentorsChallenges/intro-component-with-signup-form-master/script.js
        modified:   ../../FrontEndMentorsChallenges/intro-component-with-signup-form-master/style.css
        modified:   ../../FrontEndMentorsChallenges/intro-component-with-signup-form-master/style1.css
        deleted:    ../../intro-component-with-signup-form-master/.gitignore
        deleted:    ../../intro-component-with-signup-form-master/README.md
        deleted:    ../../intro-component-with-signup-form-master/design/active-states.jpg
        deleted:    ../../intro-component-with-signup-form-master/design/desktop-design.jpg
        deleted:    ../../intro-component-with-signup-form-master/design/desktop-preview.jpg
        deleted:    ../../intro-component-with-signup-form-master/design/mobile-design.jpg
        deleted:    ../../intro-component-with-signup-form-master/images/bg-intro-desktop.png
        deleted:    ../../intro-component-with-signup-form-master/images/bg-intro-mobile.png
        deleted:    ../../intro-component-with-signup-form-master/images/favicon-32x32.png
        deleted:    ../../intro-component-with-signup-form-master/images/icon-error.svg
        deleted:    ../../intro-component-with-signup-form-master/index.html
        deleted:    ../../intro-component-with-signup-form-master/script.js
        deleted:    ../../intro-component-with-signup-form-master/style-guide.md
        deleted:    ../../intro-component-with-signup-form-master/style.css
        deleted:    ../../intro-component-with-signup-form-master/style1.css

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        ../
        ../../Access 2013.lnk
        ../../BradTraversery CodeAlong Projects/
        ../../Excel 2013.lnk
        ../../Fonts/
        ../../Fork.lnk
        ../../FrontEndMentorsChallenges/Travelix-master/    
        ../../FrontEndMentorsChallenges/coding-bootcamp-testimonials-slider-master/
        ../../FrontEndMentorsChallenges/four-card-feature-section-master/  section-master/                                                       ster/
        ../../FrontEndMentorsChallenges/fylo-data-storage-component-macomponent-master/                                                     ster/
        ../../FrontEndMentorsChallenges/single-price-grid-component-macomponent-master/
        ../../GameProjects/
        ../../IDLE (Python 3.8 64-bit) (2).lnk
        ../../Mozilla Docs/
        ../../Node.js.lnk
        ../../OneNote 2013.lnk
        ../../Outlook 2013.lnk
        ../../PDFMate PDF Converter Professional.lnk        
        ../../PowerPoint 2013.lnk
        ../../Projects/
        ../../Publisher 2013.lnk
        ../../Python 3.8 Manuals (64-bit).lnk
        ../../Saved Pictures/
        ../../Shallom - Chrome.lnk
        ../../Sublime Text 3.lnk
        ../../Transparent PNG/
        ../../Visual Studio Code.lnk
        ../../W3schools(offline Version).lnk
        ../../Word 2013.lnk
        ../../desktop.ini
        ../../devroad8.png
        ../../fontawesome-free-5.13.0-web/
        ../../fontawesome/
        ../../stemcoders.jpg
        ../../w3designs/

this is what i get when i git status

Minar Mahmud
  • 2,577
  • 6
  • 20
  • 32
  • 1
    You can ignore files in git by using the `.gitignore` file: https://git-scm.com/docs/gitignore – zeterain Jun 27 '20 at 03:05
  • The deleted files were previously added to your repository, so the delete either needs to be committed or reversed. – zeterain Jun 27 '20 at 03:06

3 Answers3

0

It appears that you have a git repository created at a very high level in your filesystem, this is not typical for git repositories.

Option one: Add all the files you don't want tracked by git into your .gitignore file. This needs to be at the same level as the .git folder (in this case ../..) to apply to the whole repository.

Option two: Break your repository into several smaller repositories, each corresponding to a single project. First, make sure all your files are on your local machine or can be accessed in GitHub. Then delete the .git folder in ../... Finally, initialize a git repository in each project with the command git init. (It seems like intro-component-with-signup-form-master and each folder in FrontEndMentorsChallenges would be good candidates for this.)

I would strongly recommend option two as it better reflects how git is designed and will save you a lot of headaches down the line.

Daly
  • 787
  • 2
  • 12
  • 23
0

You can use interactive git clean with -i or --interactive and -d to clean directories as well.

foo@bar:~$ git clean -id
  # shows a list of untracked files and directories 
*** Commands ***
    1: clean                2: filter by pattern    3: select by numbers    4: ask each
    5: quit                 6: help
What now>

Now you have your options do clean the untracked files and directories.


NOTE

-n or --dry-run is a helpful option with git clean, which doesn't clean anything, just shows what would happen.

Can be used as git clean -idn

Minar Mahmud
  • 2,577
  • 6
  • 20
  • 32
0

Very Simple way to clean your working tree and removing untracked files

git clean -n // It would ask you about clean your all untracked files
git clean -f // and it clean all untracked files  finally
Tushar Jain
  • 134
  • 1
  • 12