5

When in magit, I pressed i on a file and asked if I would like to ignore the file locally or globally. I chose locally.

I assumed that it would write a line in my .gitignore file but unfortunately that's not the case and I can't find any reference for un-ignoring said file.

How can I un-ignore a file ignored locally with magit?

Version info:

GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2018-07-05
Magit 20190202.1535, Git 2.20.1, Emacs 26.1, gnu/linux
2
  • Probably look in .git/info/exclude
    – phils
    Commented Feb 11, 2019 at 23:34
  • @phils - wow there it is, thanks! Could you submit that as an answer? Commented Feb 11, 2019 at 23:35

1 Answer 1

6

.git/info/exclude is where "local" (only in your working copy; not tracked) ignore patterns are listed. This is a standard feature of Git.

Magit writes to either that file or .gitignore, as required.

5
  • 1
    So if I'm correct: "locally" writes to .git/info/exclude, whereas "globally" writes to .gitignore? Commented Feb 11, 2019 at 23:44
  • 4
    Yes, the "globally" terminology seems to have been introduced in v2.90.0, and it does indeed mean the repository's tracked .gitignore file. The term might be considered a bit ambiguous, as Git provides a third ignore option which is arguably "more global" (setting core.excludesFile in ~/.gitconfig, which affects any repository), which I think easily leads to the misunderstanding you experienced -- particularly when .git/info/exclude is unfamiliar. Perhaps the phrasing in the pop-up needs to be reconsidered.
    – phils
    Commented Feb 12, 2019 at 0:51
  • 5
    Jonas has improved the terminology and command set on the transient branch, which should land in master soon. The gitignore popup includes "shared at toplevel (.gitignore)" => magit-gitignore-in-topdir, "shared in subdirectory (path/to/.gitignore)" => magit-gitignore-in-subdir, "privately (.git/info/exclude)" => magit-gitignore-in-gitdir, and "privately for all repositories (<core.excludesfile>)" => magit-gitignore-on-system.
    – Kyle Meyer
    Commented Feb 12, 2019 at 16:58
  • 2
    github.com/magit/magit/commit/… and github.com/magit/magit/commit/… show that the docstrings are likewise clarified, so everything seems to have been taken care of already :)
    – phils
    Commented Feb 12, 2019 at 19:33
  • The transient branch has now been merged to master, so early-adopters will be seeing these changes now, and presumably everyone else will see it from version 2.91.
    – phils
    Commented Feb 16, 2019 at 1:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.