Is there an ignore command for git like there is for svn?

后端 未结 11 2629
一个人的身影
一个人的身影 2020-12-23 00:21

I am a new user to git and I am starting a new project. I have a bunch of dot files that I would like to ignore. Is there an ignore command for git

11条回答
  •  旧巷少年郎
    2020-12-23 00:43

    Using the answers already provided, you can roll your own git ignore command using an alias. Either add this to your ~/.gitconfig file:

    ignore = !sh -c 'echo $1 >> .gitignore' -
    

    Or run this command from the (*nix) shell of your choice:

    git config --global alias.ignore '!sh -c "echo $1 >> .gitignore" -'
    

    You can likewise create a git exclude command by replacing ignore with exclude and .gitignore with .git/info/exclude in the above.

    (If you don't already understand the difference between these two files having read the answers here, see this question.)

提交回复
热议问题