1

Vim creates ignore files. For example, the file foo.bar, would have an associated: .foo.bar.un~.

I'm trying to get git to ignore all hidden files, with the exception of .gitignore:

.*
!.gitignore

However, this misses some undo files.

Running git check-ignore confirms that: public/.index.html.un~ is caught by .*, but src/screens/.HomeScreen.js.un~ is not caught by anything...

The only difference that I can see is that it's two directories in, rather than one, but this shouldn't make a difference, from my understanding of the gitignore format.

Alex
  • 2,270
  • 3
  • 33
  • 65
  • 2
    I ran a test and found `src/screens/.HomeScreen.js.un~` was ignored as expected. Is it possible that you have already added and committed `src/screens/.HomeScreen.js.un~`? – ElpieKay Jun 17 '19 at 01:04
  • @ElpieKay Ah... I thought that adding a file to gitignore would remove it from the repo, even if it had been committed before. I get the impression that that's wrong! – Alex Jun 17 '19 at 01:05
  • 2
    Possible duplicate of [How to stop tracking and ignore changes to a file in Git?](https://stackoverflow.com/questions/936249/how-to-stop-tracking-and-ignore-changes-to-a-file-in-git) – melpomene Jun 17 '19 at 05:17
  • @Alex no if you explicitly ask git to track a file it will – D. Ben Knoble Jun 17 '19 at 20:54

0 Answers0