Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub Desktop is committing ignored files [duplicate]

My GitHub Desktop app is trying to commit a bunch of files that are (supposedly) ignored.

GitHub Desktop Screenshot

As you can see, the entire .metadata folder is listed in my top-level .gitignore file. Still, there are loads of files from that folder that are being committed each time. Am I missing something about where the file needs to be placed?

EDIT: I should add, please do not just tell me to use the command line.

like image 989
Derek Avatar asked Apr 12 '17 22:04

Derek


People also ask

How do I stop Git from ignoring files?

If you don't want Git to track certain files in your repository, there is no Git command you can use. (Although you can stop tracking a file with the git rm command, such as git rm --cached .) Instead, you need to use a . gitignore file, a text file that tells Git which files not to track.

Does Git checkout overwrite ignored files?

Silently overwrite ignored files when switching branches. This is the default behavior. Use --no-overwrite-ignore to abort the operation when the new branch contains ignored files. Using --recurse-submodules will update the content of all active submodules according to the commit recorded in the superproject.

Why is Git ignoring my Gitignore?

Some times, even if you haven't added some files to the repository, git seems to monitor them even after you add them to the . gitignore file. This is a caching issue that can occur and to fix it, you need to clear your cache.

Why does Git ignore some files?

Ignored files are usually build artifacts and machine generated files that can be derived from your repository source or should otherwise not be committed. Some common examples are: dependency caches, such as the contents of /node_modules or /packages. compiled code, such as .o , .pyc , and .class files.


1 Answers

Most often the case is that if the files existed before they were added to the .gitignore file, they will not be ignored in any following commits or pushes.

My suggestions for you, since you don't want to use the command line, is cut the files/directories from your git directory, perform a commit, and then push. After the push finished, you can paste the offending files/directories back into the git repo and they should now be ignored.

Just in case you wanted to know, you can use the git bash git rm -r --cached some-directory and then perform a commit and push and you will have achieved the same result.

like image 191
djreisch Avatar answered Oct 03 '22 20:10

djreisch