2

Using magit (version: 20190413.1201) with Emacs 26.1, and I notice that magit ignores what my global .gitignore file (~/.gitignore) says. For instance, tilde files (somefile~) continue to show up in magit, but not when using normal command line git (from a proper terminal). Any ideas?

There is a similar question https://emacs.stackexchange.com/questions/14122/both-vc-and-magit-cannot-see-global-gitignore, with the response being:

It turned out Emacs's HOME and Git's were different. I've added the HOME environment variable and moved my .emacs there. All works fine now. Thanks @YoungFrog, you made me think about my HOME

But I don't really understand that sentence. $HOME is the same when querying Emacs or the terminal process.

n_x_l
  • 1,552
  • 3
  • 17
  • 34

1 Answers1

1

For instance, tilde files (somefile~) continue to show up in magit,

Make sure those files are not already versioned (tracked by Git), because no amount of .gitignore (global or not) would remove them from Git/Magit consideration.
You would need to remove them (git rm --cached) first, before seeing those files not showing up anymore.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Not exactly what I did but your answer is correct in spirit. I removed the last ~ file from my repository before staging (but forgot how, I think through magit itself), and new ones do not show up anymore. Therefore I select this as the correct answer. – n_x_l Apr 15 '19 at 18:32