Remove files from master at github

13,208

Use git rm --cached FILENAME to delete it from the repository but keep the file physically and git add FILENAME to add a file to your repository. You will need to commit both of these changes with git commit

Share:
13,208
danielsvane
Author by

danielsvane

Updated on June 21, 2022

Comments

  • danielsvane
    danielsvane almost 2 years

    First time playing with git, and I accidentally added all hidden files with my commit. Now that I have set up my .gitignore, and committed my changes, all the files ending with "~" are still there.

    How do I commit my local files, and remove those from master that are not supposed to be there any more?

  • Admin
    Admin about 12 years
    I didn't know about the --cached flag. +1 for that. :)
  • danielsvane
    danielsvane about 12 years
    Is there any way to remove all untracked/ignored files, so I don't have to manually do this? Gedit creates a hidden file for everything it has opened apparently.
  • QuantumBlack
    QuantumBlack about 12 years
    Are the files spread all over your directory structure? If not, use some GUI utilities like tortoisegit to easily do that.
  • QuantumBlack
    QuantumBlack about 12 years
    windows search to list all your "~" files + tortoisegit = win