git 新分支提交:未在状态中找到新文件或提交

git new branch commit : new files not found on status or to commit

我的团队正在使用 bitbucket 来管理我们的团队项目,该项目是在 Visual Studio 2013 年开发的。维护我们的工作简单易行。

最后一天,我在 git 上为我的项目创建了一个 new branch,名为 version2

$ git branch version2
$ git branch
  * master
    version2
$git checkout test

$ git branch
  master
* version2

所以现在项目在version2分支上。并且项目本地位置保持不变。

我面临以下问题,

If we are adding a new file and check the git status, there is nothing to show for commit. But if we modify any existing file, which works fine or able to commit. Only newly added files are missing.

这是什么原因?我错过了什么?

Git 默认情况下不会自动跟踪新文件。你需要 运行

git add <newfile>

在每个新文件上。 git status 会告诉你这个:

$ git status
[...]
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        foo.txt

如果文件未显示在 git statusUntracked files 部分中,它们可能被您的 .gitignore 文件之一忽略。