git commit 的时候如何添加大段的注释
ringa_lee
ringa_lee 2017-04-24 09:11:34
0
7
868

为什么我在用osx上的git的时候用

git commit -a

会出现

Aborting commit due to empty commit message.

的确会跳出编辑器让我输入commit信息,但是保存之后tig中依然没有提交的信息,也就是之前被那个空消息错误给打断了,但是照理来说不是可以通过这个方法来编写大段的commit信息么,难道需要做什么配置,求教

ringa_lee
ringa_lee

ringa_lee

reply all(7)
刘奇

First, use the following command to set git默认的编辑器,其中的“editor" and replace it with your own editor, such as Vim, Emacs, gedit, subl, etc.:

git config --global core.editor "editor -w"

Then, when making a submission, use the command instead of writing "-m"参数,直接写成git commitJust like this, it will automatically open the editor you just specified, and you can add large comments in it.

黄舟

Using macvim as the editor for commit, using -f参数能避免下面的提示.-whas no effect.

Aborting commit due to empty commit message.

Modify git config in the terminal as follows

git config --global core.editor "/bin/mvim -f"
左手右手慢动作

You can view Git help.
-m , --message=
Use the given as the commit message.

Comment based on the given information. The comment content should be enclosed in double quotes.
-a, --all
Tell the command to automatically stage files that have been
modified and deleted, but new files you have not told git about are
not affected

All modified and deleted files are listed, but new files are not.

Ty80
git config --global core.editor "[your editor] -w"

-w tells Git to use the specified editor

How to use Git:

touch README.md
git init
git add README.md
# git commit -m "first commit" # 命令行添加提交信息
git commit # 编辑器添加提交信息
Ty80

git commit -am "bla bla bla"

Peter_Zhu

Have you ever used git gui? However, the git commit -m "your description" command is just for quick submission next time.

PHPzhong

git commit
Then just write your commit comments.
Note: Keep the first line as concise as possible, within 50 characters, then leave a blank line before continuing to write detailed comments.

Also, you can refer to this: "Write a good commit message"

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template