什么是< pathspec>在git命令? [英] What's a <pathspec> in the git command?

查看:220
本文介绍了什么是< pathspec>在git命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经更新,修改并删除了我的应用程序中的文件,现在我已准备好提交。以下是状态:

  C:\ G\ab\WebAdminApp> git status 
在分支主机上
您的分支与origin / master保持同步。

没有为commit提交的变化:
(使用git add / rm< file> ...来更新将提交的内容)
(使用git checkout - - < file> ...放弃工作目录中的更改)

修改:WebAdminApp.csproj
修改:WebAdminApp.csproj.user $ b $修改:app / admin /控制器/ ContentController.ts
删除:app / admin / interfaces / IEnumService.ts
修改:app / admin / interfaces / IHomeController.d.ts
修改:lib / pagedown / Markdown.Sanitizer .ts
删除:lib / typings / global.ts
修改:package.json
修改:../abilitest-admin.v12.suo

未记录的文件:
(使用git add< file> ...来包含将要提交的内容)

app / interfaces / IEnumService.d.ts
app / interfaces /IUtilityService.d.ts
../npm-debug.log

未添加更改提交(使用g它添加和/或git commit -a)



当我输入时:

  git add。 

它给我一个消息:

  C:\G\ab\WebAdminApp> git add。 
警告:您运行的'git add'既没有'-A(--all)'也没有'--ignore-removal',
,它们的行为将在Git 2.0中相对于您删除的路径发生变化。
这个版本的Git将忽略从工作树中删除
的'WebAdminApp / app / admin / interfaces / IEnumService.ts'等路径。

*'git add --ignore-removal< pathspec>',这是当前的默认值,
会忽略您从工作树中删除的路径。

*'git add --all< pathspec>'会让您记录删除。

我想在我的本地PC上做的所有事情都被提交,然后我想让GITHUB上的主人以反映这一点。

有人可以解释 是什么意思,现在应该输入什么内容,以便所有更改都可以使用git commit进行提交?对不起,我不清楚。是目录或?

解决方案

Git词汇表
$ b


[A pathspec是一个模式]用于限制Git命令中的路径。



Pathspecs用于git ls-files,git ls-tree,git add命令行, git grep,git diff,git checkout以及许多其他命令将操作范围限制为树或工作树的某个子集。

例如,命令 git add:/ **。ts 将递归添加到索引中的所有以<$ c结尾的文件$ c> .ts 从版本库的根目录开始(尊重忽略文件的各种方式)。

I have updated, modified and removed files in my application and I am now ready to commit. Here is the status:

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

no changes added to commit (use "git add" and/or "git commit -a")

When I enter:

git add . 

It gives me a message saying:

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.

I would like everything I did on my local PC to be committed and then I want the master on GITHUB to reflect this.

Can someone explain what does it mean and what should I now enter so all the changes can be committed with a git commit ? Sorry it's not clear to me. Is the directory or ?

解决方案

From the Git Glossary:

[A pathspec is a pattern] used to limit paths in Git commands.

Pathspecs are used on the command line of "git ls-files", "git ls-tree", "git add", "git grep", "git diff", "git checkout", and many other commands to limit the scope of operations to some subset of the tree or worktree.

As an example, the command git add :/**.ts will recursively add to the index all of the files that end with .ts starting at the root of the repository (respecting the various ways of ignoring files).

这篇关于什么是&lt; pathspec&gt;在git命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆