代码之家  ›  专栏  ›  技术社区  ›  Markus

如何选择不应拉入存储库的文件?[副本]

  •  0
  • Markus  · 技术社区  · 6 年前

    我特别想要这个文件 myBackend/src/main/resources/application.properties 因为每个用户都将本地设置放在模板上,所以无法同步 application.properties 储存在 develop 分支机构。

    Your branch is up-to-date with 'origin/develop'.
    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git checkout -- <file>..." to discard changes in working directory)
    
        modified:   README.md
        modified:   myBackend/docker-compose.yml
        modified:   myBackend/src/main/resources/application.properties
    
    Untracked files:
      (use "git add <file>..." to include in what will be committed)
    
        myBackend/udo systemctl start docker
    
    no changes added to commit (use "git add" and/or "git commit -a")
    

    另外,我还有一些奇怪的未追踪文件 myBackend/udo systemctl start docker udo sudo .

    1 回复  |  直到 6 年前
        1
  •  2
  •   Chukwuemeka Inya    6 年前

    git clean 是你要找的人。

    首次运行:

    git clean -n      //This will display the untracked files that will be removed
    

    git clean -f      //To remove the file(s) - Note: Remove here means Delete
    

    如果是目录,请执行以下操作:

    git clean -fd
    

    最后,要忽略文件,只需将它们添加到 .gitignore

    所以,对你来说,

    Add myBackend/src/main/resources/application.properties to your .gitignore file.