1

I am starting with Git and Github and with git status command it is throwing this:

On branch master Your branch is up-to-date with 'remotes/reflections/master'. Untracked files: (use "git add ..." to include in what will be committed)

    .DS_Store
    .Rhistory
    .Trash/
    .android/
    .bash_history
    .bash_profile
    .bash_profile.swp
    .dropbox/
    .gitconfig
    .oracle_jre_usage/
    .rstudio-desktop/
    .subversion/
    .viminfo
    1.Sueña/
    AndroidStudioProjects/.DS_Store
    Applications/
    Desktop/
    Downloads/
    Library/

nothing added to commit but untracked files present (use "git add" to track)

It is giving to me name of directories like Desktop/ or Librery/ ...

I have tried with git reset --hard but it isn't working.

How can I delete these untracked files and folders without deleting them from my computer irreversibly.

Any help, will be appreciated

Thanks in advance

Jose Gallo
  • 134
  • 1
  • 9
  • `git rm --cached ` Also this is a duplicate. http://stackoverflow.com/questions/1143796/remove-a-file-from-a-git-repository-without-deleting-it-from-the-local-filesyste – toshiomagic Sep 17 '16 at 14:57
  • thanks @toshiomagic but I doesn't work – Jose Gallo Sep 17 '16 at 15:07
  • You asked "How can I delete these untracked files and folders without deleting them from my computer irreversibly." If this is not your question, change the question. – toshiomagic Sep 17 '16 at 15:18

4 Answers4

2

You need to add all of them first and reset the repo:

git add --all
git reset --hard HEAD
orvi
  • 3,142
  • 1
  • 23
  • 36
  • 3
    you may use `git clean -f -d` for that – orvi Sep 17 '16 at 15:16
  • Thanks @orvi, and sorry for the previous comment, with git add-all gives me errors: fatal: unable to stat 'Library/Caches/Google/Chrome/Default/Cache/f_000530': No such file or directory and fatal: unable to stat 'Library/Preferences/ByHost/com.apple.coreservices.appleidauthenticationinfo.F0AA6FE4-76EC-5605-AAF0-2050AB13CE5D.plist.7CZtq0a': No such file or directory and after that with git reset --hard HEAD, git status gives to me the same message. – Jose Gallo Sep 17 '16 at 15:17
  • First try to removed the file from git, then re-added it by doing the following: `git rm "Library"` – orvi Sep 17 '16 at 15:25
  • it is not help, it is said `unable to rmdir project/folder`: Directory is not empty – Alexy Khilaev Jul 28 '23 at 10:38
1

Sounds like you're looking for gitignore: https://git-scm.com/docs/gitignore

"A gitignore file specifies intentionally untracked files that Git should ignore."

tglassner
  • 11
  • 1
0

You may want to try moving all those folders/files out of your repo temporarily. Do a git add . commit/push. Then move the ignored files back into your repo. This will be certain to remove your unwanted files from the remote repo

Vinnie James
  • 5,763
  • 6
  • 43
  • 52
0

There's a .gitignore file in the base directory. Put all these files or paths of these files in it. Then they'll not come during git status.

Don't do git add or git commit, else you'll see a hard time dealing with these files.

Ankit Bhatnagar
  • 745
  • 5
  • 16