linux git add排除文件,git只添加修改后的更改并忽略未跟踪的文件 - git add only modified changes and ignore untracked files...

问题:

I ran "git status" and listed below are some files that were modified/or under the heading "changes not staged for commit". 我运行了“git status”,下面列出了一些被修改的文件/或标题为“未提交更改的更改”标题。 It also listed some untracked files that I want to ignore (I have a ".gitignore" file in these directories). 它还列出了一些我想忽略的未跟踪文件(我在这些目录中有一个“.gitignore”文件)。

I want to put the modified files in staging so I can commit them. 我想将修改后的文件放在暂存中,以便我可以提交它们。 When I ran "git add .", it added the modified files AND the files I want to ignore to staging. 当我运行“git add。”时,它将修改后的文件和我想忽略的文件添加到登台。

How do I add only the modified files and ignore the untracked files if presented with the git status below. 如果使用下面的git状态显示,如何仅添加已修改的文件并忽略未跟踪的文件。

Also, are my ".gitignore" files working properly? 另外,我的“.gitignore”文件是否正常工作?

$ git status

# On branch addLocation

# Changes not staged for commit:

# (use "git add ..." to update what will be committed)

# (use "git checkout -- ..." to discard changes in working directory)

#

# modified: someProject/path/domain/viewer/LocationDO.java

# modified: someProject/path/service/ld/LdService.java

# modified: someProject/path/service/ld/LdServiceImpl.java

# modified: someProject/path/web/jsf/viewer/LocationFormAction.java

# modified: someProject/war/WEB-INF/classes/message/viewer/viewer.properties

# modified: someProject/war/page/viewer/searchForm.xhtml

#

# Untracked files:

# (use "git add ..." to include in what will be committed)

#

# .metadata/

# someProject/build/

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

解决方案:参考一:

https://stackoom.com/question/TtSw/git只添加修改后的更改并忽略未跟踪的文件

参考二:

https://oldbug.net/q/TtSw/git-add-only-modified-changes-and-ignore-untracked-files

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值