git looks for a .gitignore file in your current local clone (the dir with .git dir) but you can DRY your gitignore for all your projects by maintaining a global gitignore in a ~/.gitignore for example and you tell git where it is with a core.excludesfile section declaration.
example:
git config --global core.excludesfile
.. should tell you if you have it(if any) If not, you can declare the file where your global user gitignore file is with:
Examine your global git config with git config --global --list or brute force just open your $HOME/.gitconfig file
Once you set up a global .gitignore excludesfile you will not need to keep pasting the same .gitingnore in each repo you work in, thus you have sensible defaults and DRY in play. All the best
so ~/.gitignore as a custom filename to be mentioned in ~/.gitconfig under core.excludesfile is an alternative to ~/.config/git/ignore, but can we say that we are sure no outdated version of Git ever had ~/.gitignore hardcoded, and no outdated version of Git walked further up than $GIT_WORK_TREE looking for .gitignore?
git does not walk UP anywhere, if I can say that. It only acts on the current directory where .git lives; but it also uses the global file (user space, the global in this context means You, the user, not everyone on the machine) located at ~/.gitconfig, which governs how git behaves for You, the user (global may be confusing to people) in all the repos you work on that machine (repo, meaning a working dir with .git dir)
The declaration core.exludesfileasks you to point to a file that holds the global (to you) ignore patterns you want to apply to all REPOS you have in your workspace. (git-scm.com/docs/gitignore)
Where the ignore file is located is irrelevant, but by some sensible default I would suggest ~/.gitingnore, yet it can be ~/gitlistaignorancja or ~/whatever-blabla-git ... - and no, git never hardcodes the ~/.gitignore name (only local .git/gitignore) . It does respect the GIT_DIR/.gitignore because it treats it as a WORKSPACE local ignore patterns (in addition to what's in global excludesfile)
Git does not walk up to any dirs up to find stuff (unlike NPM if you ever worked with it). It only looks at your local WORKING DIR (local gitconfig), the global (user space) declarations in ~/.gitignore and the system (indeed global to all users) file. Hope this makes sense.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
git looks for a
.gitignore
file in your current local clone (the dir with .git dir) but you can DRY your gitignore for all your projects by maintaining a global gitignore in a ~/.gitignore for example and you tell git where it is with acore.excludesfile
section declaration.example:
git config --global core.excludesfile
.. should tell you if you have it(if any) If not, you can declare the file where your global user gitignore file is with:
git config --global core.excludesfile "$HOME"/.gitignore
Examine your global git config with
git config --global --list
or brute force just open your $HOME/.gitconfig fileOnce you set up a global .gitignore excludesfile you will not need to keep pasting the same .gitingnore in each repo you work in, thus you have sensible defaults and DRY in play. All the best
so
~/.gitignore
as a custom filename to be mentioned in~/.gitconfig
undercore.excludesfile
is an alternative to~/.config/git/ignore
, but can we say that we are sure no outdated version of Git ever had~/.gitignore
hardcoded, and no outdated version of Git walked further up than$GIT_WORK_TREE
looking for.gitignore
?git does not walk UP anywhere, if I can say that. It only acts on the current directory where
.git
lives; but it also uses the global file (user space, the global in this context means You, the user, not everyone on the machine) located at~/.gitconfig
, which governs how git behaves for You, the user (global may be confusing to people) in all the repos you work on that machine (repo, meaning a working dir with .git dir)The declaration
core.exludesfile
asks you to point to a file that holds theglobal
(to you) ignore patterns you want to apply to all REPOS you have in your workspace. (git-scm.com/docs/gitignore)Where the ignore file is located is irrelevant, but by some sensible default I would suggest
~/.gitingnore
, yet it can be~/gitlistaignorancja
or~/whatever-blabla-git
... - and no,git
never hardcodes the~/.gitignore
name (only local .git/gitignore) . It does respect theGIT_DIR/.gitignore
because it treats it as aWORKSPACE
local ignore patterns (in addition to what's in global excludesfile)Git does not walk up to any dirs up to find stuff (unlike NPM if you ever worked with it). It only looks at your local WORKING DIR (local gitconfig), the global (user space) declarations in
~/.gitignore
and the system (indeed global to all users) file. Hope this makes sense.