【问题标题】:Why is there no git commit -A -m? It must have been deliberately omitted, but why?为什么没有 git commit -A -m?它一定是故意省略的,但为什么呢?
【发布时间】:2012-11-22 13:31:12
【问题描述】:

所以我可以使用git commit -a -m "Add whatever" 组合git add -agit commit -m "Add whatever",但这只会暂存跟踪的文件。为什么 git 不提供 git commit -A -m "Add whatever" 以便我也可以暂存未跟踪的文件。这似乎是一个明显的捷径,所以我想知道为什么它被省略了。

【问题讨论】:

    标签: git stage


    【解决方案1】:

    请随意在 git 邮件列表中提出建议,或者更好地发送补丁。请注意,尽管许多 Git 人不鼓励使用 -a 进行添加和提交,因为您完全无法控制实际添加的内容。

    话虽如此,您也可以创建一个兼具两者的别名:

    git config --global alias.commitall "!git add -A && git commit -m $0"
    

    然后您只需输入git commitall "Add whatever",它就会添加并提交所有内容。

    【讨论】:

      猜你喜欢
      • 2011-07-07
      • 2011-02-17
      • 1970-01-01
      • 2011-02-15
      • 1970-01-01
      • 2021-05-25
      • 2021-08-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多