How can I force “git commit -s” using “git commit” command?

℡╲_俬逩灬. 提交于 2019-12-01 14:07:49

[Edit made after last comment]

I think if I am guessing correctly then, you cannot alias using words which are 'reserved' words for a git command.

However if you do something like this

[alias]
  ci = commit -s

Then it will do what you want it to do.

Use the commits hooks to achieve this
https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks#_committing_workflow_hooks

prepare-commit-msg

The prepare-commit-msg hook is run before the commit message editor is fired up but after the default message is created.

It lets you edit the default message before the commit author sees it.

This hook takes a few parameters: the path to the file that holds the commit message so far, the type of commit, and the commit SHA-1 if this is an amended commit.

This hook generally isn’t useful for normal commits; rather, it’s good for commits where the default message is auto-generated, such as templated commit messages, merge commits, squashed commits, and amended commits.

You may use it in conjunction with a commit template to programmatically insert information.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!