嗨,我刚刚开始我的git回购,这是我第一次在Windows中使用git
无论如何,我已经添加了我的项目并提交了,但是,每当我修改一个文件,它认为我需要重新添加,即使我已经这样做了。
$ git status # On branch master # 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: bonfire/content.php # modified: bonfire/style_1.css # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # .htaccess # .htaccess_del # .smileys/ # 1.htaccess # docs/ # nbproject/ no changes added to commit (use "git add" and/or "git commit -a") $ git add bonfire/content.php $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: bonfire/content.php # # 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: bonfire/style_1.css # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # .htaccess # .htaccess_del # .smileys/ # 1.htaccess # docs/ # nbproject/
我真的不想继续这样做。 我相信我正确地添加了该项目。 不知道该怎么做
谢谢
这只是如何工作,您的存储库设置正确。 您提交暂存区域的内容,而不是您的工作树,因此您必须首先将更改添加到暂存区域。 如果您只想提交一些更改或将更改拆分为多个提交,那么这非常方便,因为甚至可以将部分文件更改添加到暂存区域(使用git add -p )。
但是,如果你只是想提交所有的修改文件,有一个捷径:只要使用git commit -a 。 这将直接提交工作树中的所有修改和删除的文件。 您仍然必须手动添加新创建的文件,但听起来就像您期望的那样。