git:仅暂存新文件 [英] git: stage only new files

查看:29
本文介绍了git:仅暂存新文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我有:

  • 脏工作目录,
  • 肮脏的集结区,
  • 然后我将一些新文件复制到项目中,

我如何只上演新的?

git alias adduntracked=…

推荐答案

此别名将尊重您的忽略模式(内置、全局和每个目录,如 git-ls-files --exclude 的帮助中所述-标准).它将在树的顶层运行.

This alias will respect your ignore patterns (builtin, global and per-directory, as described by the help for git-ls-files --exclude-standard). It will run at the top level of your tree.

[alias]
adduntracked=!git add $(git ls-files -o --exclude-standard)

这篇关于git:仅暂存新文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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