Git commit opens blank text file, for what?

前端 未结 17 1000
长情又很酷
长情又很酷 2020-12-22 18:33

In all the Git tutorials I\'ve read they say that you can do:

git init
git add .
git commit

When I do that I get a big text file opened up.

17条回答
  •  长情又很酷
    2020-12-22 19:08

    As mentioned by Ben Collins, without the -m "..." argument to type the commit inline (which is generally a bad idea as it encourages you to be brief), this "big text file" that is opened up is a window in which to type the commit message.

    Usually it's recommended to write a summary in the first line, skip a line, and then write more detailed notes beneath; this helps programs that do things like email the commit messages with an appropriate subject line and the full list of changes made in the body.

    Instead of changing the EDITOR shell variable, you can also change the editor used by adding the additional lines in your ~/.gitconfig file:

    [core]
        editor = emacs
        excludesfile = /Users/will/.gitignore
    

    That second line actually has nothing to do with your problem, but I find it really useful so I can populate my ~/.gitignore file with all those filetypes I know I'll never, ever, want to commit to a repository.

提交回复
热议问题