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

后端 未结 11 2672
一个人的身影
一个人的身影 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:37

    for names not present in the working copy or repo:

    echo /globpattern >> .gitignore
    

    or for an existing file (sh type command line):

    echo /$(ls -1 file) >> .gitignore   # I use tab completion to select the file to be ignored  
    git rm -r --cached file             # if already checked in, deletes it on next commit
    

提交回复
热议问题