What to do after typing in commit message for git?

女生的网名这么多〃 提交于 2019-12-22 01:13:47

问题


After I type in git commit -a a text editor pops up and I type in my comment. What buttons do I have to press after typing in the comment, to get it to move to the next stage of actually committing?

I'm using mysysGit on Windows with the default setup.


回答1:


Depends on the text editor you are using. Git chooses the editor specified in the environment variable "EDITOR." On Linux systems this is usually either Vi or Nano. Figure out which it is and then refer to the documentation for the appropriate editor.




回答2:


Save the file and exit your editor.




回答3:


try this:

git add file-name  
git commit -m "here goes my awesome commit message"  
git push  



回答4:


A git commit always requires a comment. You can give one like this git commit -m "my comment". If you do not provide a comment here, then a text editor pops up to force you to give a comment.

Sometimes, you may actually need the editor to put in the commit message. This generally is required when you want to give a more detailed description of the commit along with the summary (write the summary followed by a blank line followed by the description).

This is an extract from git help commit.

Though not required, it's a good idea to begin the commit message with a single short (less than 50 character) line summarizing the change, followed by a blank line and then a more thorough description. Tools that turn commits into email, for example, use the first line on the Subject: line and the rest of the commit in the body.

EDIT:

And after you type text in your text editor, just save and close it. If you try to do it without providing any comment, the commit will fail.



来源:https://stackoverflow.com/questions/5048859/what-to-do-after-typing-in-commit-message-for-git

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