Commit and automatically add all untracked files

后端 未结 5 1877
南方客
南方客 2020-12-23 09:07

I often forgot that I have some new files and directly do,

git commit -a -m \"My commit message\"

This only commits changed files, and I ha

5条回答
  •  轮回少年
    2020-12-23 09:45

    It's not possible using the default git interface. However, git supports aliases.

    Using an alias, it's possible to invoke a different git command, or even run arbitrary shell scripts. Create a script containing the two commands, and alias it.

    See the wiki for more information on aliases, and this question for this specific scenario.

    Edit: note that this is not such a good idea. The chances are you'll end up adding unnecessary files by mistake, or having a useless alias due to non-versioned files in the tree.

提交回复
热议问题