為什么我在用osx上的git的時(shí)候用
git commit -a
會(huì)出現(xiàn)
Aborting commit due to empty commit message.
的確會(huì)跳出編輯器讓我輸入commit信息,但是保存之后tig中依然沒有提交的信息,也就是之前被那個(gè)空消息錯(cuò)誤給打斷了,但是照理來說不是可以通過這個(gè)方法來編寫大段的commit信息么,難道需要做什么配置,求教
ringa_lee
First, use the following command to set git
默認(rèn)的編輯器,其中的“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
"參數(shù),直接寫成git commit
Just 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
參數(shù)能避免下面的提示.-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"
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.
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 # 編輯器添加提交信息
Have you ever used git gui? However, the git commit -m "your description" command is just for quick submission next time.
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"