0

I have a folder that I always want to exclude from staging/commiting to git. I don't want to add this file to our gitignore. So whenever I stage my changes, I have been using the command git add . -- ":!./ignoreddir/".

I want this to be a default behvior of my 'git add'. So I added the following to my .gitconfig but git says I have 'bad config' on the line.

[alias]
add = add -- ":!./ignoreddir/"

What's the right way to override the command in git config?

haku
  • 4,105
  • 7
  • 38
  • 63
  • 2
    You cannot define an alias with the name of an existing command: https://stackoverflow.com/a/3538791/7976758 – phd Jan 26 '23 at 16:51
  • 2
    You can use `.git/info/exclude` to ignore files/dirs: https://stackoverflow.com/a/653495/7976758 , https://stackoverflow.com/search?q=%5Bgit%5D+ignore+without+using+%22.gitignore%22 – phd Jan 26 '23 at 16:53
  • @phd - thank-you so much. That worked! Such a lovely solution! – haku Jan 26 '23 at 17:14

0 Answers0