混帐提交自动添加新的文件夹或文件? [英] git commit auto add new folders or files?

查看:75
本文介绍了混帐提交自动添加新的文件夹或文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能让 git commit 也添加新的文件和目录?

从长远来看,很多不必要的输入必须输入 git add。然后 git commit



(也就是说,我经常忘记调用 git add。导致缺少目录等版本)

解决方案

只要我被告知没有这样的命令(当你有调试文件包含密码时可能会很危险),但如果你想模拟你可以添加这个别名到你的git配置:

  git config --global alias.commitx!git add。&& git commit

使用 git commitx 现在将执行 git add。,然后是 git commit ,所以你可以做
$ b $ $ p $ g $ commit $ -m在新的unstaged文件上测试提交


Is it possible to have git commit also add new files and directories?

It seems a lot of needless typing in the long run to have to type git add . then git commit

(That, and I have a tendency to often forget to call git add . resulting in versions with missing directories and such)

解决方案

As long as I am informed right there is no such command (It could be dangerous when you have debug-files containing passwords), but if you want to simulate you could add this alias to your git config:

git config --global alias.commitx "!git add . && git commit"

Using git commitx will now run git add . followed by git commit, so you can do

git commitx -m "testing commitx on new unstaged files"

这篇关于混帐提交自动添加新的文件夹或文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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