This is because Git does not find the default editor. It prompts you to use the "-m" or "-F" parameter to append the submission instructions. You can use git commit -- help to obtain help information. Alternatively, you can set one as follows. Here, gvim is set as the global editor of Git. Yes, the backslash "" in the shell below is required.
Git config -- global core. editor "" D: Program Files (x86w.gvimvim73gvim.exe ""
Required configuration:
1, C: \ Program Files \ Git \ etc \ git-completion.bash:
Alias ls = 'ls -- show-control-chars -- color = auto'
Note: Enter the ls command in Git Bash to display the Chinese file name normally.
2. C: \ Program Files \ Git \ etc \ inputrc:
Set output-meta on
Set convert-meta off
Note: this allows normal input of Chinese characters in Git Bash, such as the commit log in Chinese.
3. C: \ Program Files \ Git \ etc \ profile:
Export LESSCHARSET = UTF-8
Note: Unlike other vcs, the $ git log command rolls n logs from the beginning to the end. It will properly stop on the first page and press the space key to flip the page. This is achieved by sending logs to less processing. The preceding code sets less character encoding so that $ git log can display Chinese characters normally. In fact, its value does not have to be set to UTF-8, such as latin1 ....... Another method is $ git-no-pager log. If pagination is disabled in the options, you do not need to set the above options.
4. C: \ Program Files \ Git \ etc \ gitconfig:
[Alias]
Go = "! Bash-c \ "git pull & git add .; if [\\\ "$ * \\\" =\\\ "\\\"]; then git commit-; else git commit-am \ "$ * \"; fi; git push origin master: your-id ;\""
Note: With this powerful alias, we only need to enter the $ git go Command in 90%, eliminating the tedious steps of pulling and then committing and pushing.
Two usage methods:
$ Git go
Or
$ Git go aaa revision description
When the command is followed by a revision instruction, it will be submitted directly. It should be noted that there is a "aaa" before the "revision description", which is a bug. The first one in the parameter will be ignored, so you can write a random .......
If the revision instructions are not provided in the command line, an editor is automatically displayed, waiting for input. The default editor is Vim. Vim is easy to use. First, you must understand that it has two modes: command mode and input mode. The default command mode is used when Vim is started. You need to press the 'I' key to enter the input mode, and then edit it normally. After editing, switch the input method back to the English state, press Esc to enter the command mode again. Press '(Shift): wq' and press Enter. w indicates writing and saving, and q indicates exiting. Finished!
If you are not used to Vim, you can also set it to another editor:
$ Git config -- global core. editor "notepad"
Notepad can be replaced with wordpad and notepad ++, which are more useful (but they cannot be directly accessed in the command line. You must set the PATH variable first ).
The above alias is customized for Windows and can be written more elegantly in Linux. However, since there are no differences in use, keep them consistent ~.
[Gui]
Encoding = UTF-8
Note: Our code library uses UTF-8 in a unified manner, so that the Chinese characters in the code can be normally displayed in the git gui.
[I18n]
Commitencoding = GB2312
Note: If this one is not found, although we can use $ git log locally to check that our Chinese revision is correct, I. Our log will become garbled after being pushed to the server; 2. Chinese logs pushed by others in Linux are also garbled after we pull. This is because our commit log will be first stored in the project. git/COMMIT_EDITMSG file; in Chinese Windows, the newly created file uses GB2312 encoding; but Git does not know that it is sent out as the default UTF-8, so garbled characters are generated. With this article, Git will convert it to UTF-8 and then send it out, so there is no problem.