git: How to ignore all present untracked files?

前端 未结 8 1632
北恋
北恋 2020-12-22 14:57

Is there a handy way to ignore all untracked files and folders in a git repository?
(I know about the .gitignore.)

So git status would

8条回答
  •  醉话见心
    2020-12-22 15:30

    Two ways:

    • use the argument -uno to git-status. Here's an example:

      [jenny@jenny_vmware:ft]$ git status
      # On branch ft
      # Untracked files:
      #   (use "git add ..." to include in what will be committed)
      #
      #       foo
      nothing added to commit but untracked files present (use "git add" to track)
      [jenny@jenny_vmware:ft]$ git status -uno
      # On branch ft
      nothing to commit (working directory clean)
      
    • Or you can add the files and directories to .gitignore, in which case they will never show up.

提交回复
热议问题