为什么我在用osx上的git的时候用
git commit -a
会出现
Aborting commit due to empty commit message.
的确会跳出编辑器让我输入commit信息,但是保存之后tig中依然没有提交的信息,也就是之前被那个空消息错误给打断了,但是照理来说不是可以通过这个方法来编写大段的commit信息么,难道需要做什么配置,求教
怪我咯2017-04-24 09:13:34
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 commit
Just like this, it will automatically open the editor you just specified, and you can add large comments in it.
黄舟2017-04-24 09:13:34
Using macvim as the editor for commit, using -f
参数能避免下面的提示.-w
has 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"
ringa_lee2017-04-24 09:13:34
You can view Git help.
-m
Use the given
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.
PHP中文网2017-04-24 09:13:34
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 # 编辑器添加提交信息
天蓬老师2017-04-24 09:13:34
Have you ever used git gui? However, the git commit -m "your description" command is just for quick submission next time.
PHPz2017-04-24 09:13:34
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"