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?

3
  • 2
    You cannot define an alias with the name of an existing command: stackoverflow.com/a/3538791/7976758 Commented Jan 26, 2023 at 16:51
  • 2
    You can use .git/info/exclude to ignore files/dirs: stackoverflow.com/a/653495/7976758 , stackoverflow.com/… Commented Jan 26, 2023 at 16:53
  • @phd - thank-you so much. That worked! Such a lovely solution! Commented Jan 26, 2023 at 17:14

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.