我已经在我的应用程序中更新,修改和删除了文件,现在我已准备好提交.这是状态:
C:\G\ab\WebAdminApp>git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: WebAdminApp.csproj
modified: WebAdminApp.csproj.user
modified: app/admin/controllers/ContentController.ts
deleted: app/admin/interfaces/IEnumService.ts
modified: app/admin/interfaces/IHomeController.d.ts
modified: lib/pagedown/Markdown.Sanitizer.ts
deleted: lib/typings/global.ts
modified: package.json
modified: ../abilitest-admin.v12.suo
Untracked files:
(use "git add <file>..." to include in what will be committed)
app/interfaces/IEnumService.d.ts
app/interfaces/IUtilityService.d.ts
../npm-debug.log
Run Code Online (Sandbox Code Playgroud)
没有更改添加到提交(使用"git add"和/或"git commit -a")
当我进入:
git add .
Run Code Online (Sandbox Code Playgroud)
它给了我一条信息:
C:\G\ab\WebAdminApp>git add .
warning: You ran 'git add' with neither '-A (--all)' or '--ignore-removal',
whose behaviour will change in Git 2.0 with respect to paths you removed.
Paths like 'WebAdminApp/app/admin/interfaces/IEnumService.ts' that are
removed from your working tree are ignored with this version of Git.
* 'git add --ignore-removal <pathspec>', which is the current default,
ignores paths you removed from your working tree.
* 'git add --all <pathspec>' will let you also record the removals.
Run Code Online (Sandbox Code Playgroud)
我希望我在本地PC上所做的一切都得到提交,然后我希望GITHUB上的主人能够反映这一点.
有人可以解释它是什么意思 我现在应该输入什么,以便可以使用git提交来提交所有更改?对不起,我不清楚.是目录还是?
这个答案完全来自Git Pathspecs 和 How to Use Them。我没有复制所有内容,因此请查看链接以进行更深入的挖掘
这pathspec
是 git 用于将 git 命令的范围限制为存储库子集的机制。如果您使用过很多 git,那么pathspec
无论您是否知道,您都可能使用过。例如,在命令中git add README.md
,pathspec
是README.md
。但是,它具有更多的细微差别和灵活性。
那么,为什么要学习pathspec
s呢?由于它是许多命令的一部分,因此了解pathspec
s 后,这些命令会变得更加强大。使用git add
,您可以只添加单个目录中的文件。使用git diff
,您可以只检查对扩展名为.scss
. 您可以 git grep 除/dist
目录中的文件外的所有文件。
git add . # add CWD (current working directory)
git add .. # add parent directory and its subdirectories
git add src/ # add src/ directory
git add README # add only README directory
Run Code Online (Sandbox Code Playgroud)
如果你这样做ls -a
,它会列出所有文件和“目录条目”,它将包括.
和..
更多的看这里
git log '*.js' # logs all .js files in CWD and subdirectories
git log '.*' # logs all 'hidden' files and directories in CWD
git log '*/.*' # logs all 'hidden' files and directories in subdirectories
Run Code Online (Sandbox Code Playgroud)
该top
签名告诉混帐的模式从Git仓库,而不是当前工作目录的根目录匹配。您也可以使用简写:/
而不是:(top)
.
git ls-files ':(top)*.js'
git ls-files ':/*.js' # shorthand
Run Code Online (Sandbox Code Playgroud)
该icase
签名告诉混帐不关心匹配的情况下,当如这可能是有用的配套jpg
文件,有时使用大写扩展名JPG
。
git ls-files ':(icase)*.jpg'
Run Code Online (Sandbox Code Playgroud)
最后,还有“排除”魔术签名(:!
或的简写:^
)。例如,您可以搜索所有.js
文件,同时排除.spec.js
测试文件。
git grep 'foo' -- '*.js' ':(exclude)*.spec.js' # search .js files excluding .spec.js
git grep 'foo' -- '*.js' ':!*.spec.js' . # shorthand for the same
Run Code Online (Sandbox Code Playgroud)