FGF-College-Work / Forum

:beer: Espaço dedicado a discussões e tira dúvida sobre disciplinas e conteúdo tecnológico.
MIT License
13 stars 4 forks source link

How to commit a change with both “message” and “description” from the command line? [duplicate] #209

Open marcialwushu opened 4 years ago

marcialwushu commented 4 years ago

There is also another straight and more clear way

git commit -m "Title" -m "Description ..........";

Use the git commit command without any flags. The configured editor will open (Vim in this case):

To start typing press the INSERT key on your keyboard, then in insert mode create a better commit with description how do you want. For example:

Once you have written all that you need, to returns to git, first you should exit insert mode, for that press ESC. Now close the Vim editor with save changes by typing on the keyboard :wq (w - write, q - quit):

and press ENTER.

On GitHub this commit will looks like this:

As a commit editor you can use VS Code:

git config --global core.editor "code --wait"

From VS Code docs website: VS Code as Git editor


git commit -a -m $'Commit title\n\nRest of commit message...'
marcialwushu commented 4 years ago

https://stackoverflow.com/questions/16122234/how-to-commit-a-change-with-both-message-and-description-from-the-command-li