Skip to content

Commit

Permalink
move new section to right before When to commmit
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenlekhtn committed Aug 18, 2024
1 parent 22f4bbe commit 89d4df6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions git/foundations_git/commit_messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ Ahh, that's better! :) Now, developers can gain a better understanding of this c
- Contains a body that provides a concise yet clear description of why the commit needed to be made (e.g., "Screen readers won't read the images to users with disabilities without this information").
- Separates the subject from the body with a new/blank line. This is a best practice we highly recommend following. It makes commit messages easier for other developers to read.

### How to commit with a subject and body in the message

Up until now, you've been told to commit with `git commit -m <message>`. To make a commit with subject and body in message, the simplest way is to type `git commit` without the `-m` flag and message argument.

Doing so will open a new Visual Studio Code tab if you had [set Visual Studio Code as the Git editor](https://www.theodinproject.com/lessons/foundations-git-basics#changing-the-git-commit-message-editor). You can remove any comments and enter your multi-line messages. When you save and close the tab, your commit will be created.

### When to commit

A good way to view a commit is like a “snapshot” of your code at the moment that it was made. That version of your code up to that point will be saved for you to revert back to or look back at.
Expand All @@ -93,11 +99,6 @@ There will come a time when you are working on a project and you FINALLY get som
- Avoid using vague commit messages such as "saved" or "updated".
- Commit early and often!

#### How to commit with a subject and body in the message

Up until now, you've been told to commit with `git commit -m <message>`. To make a commit with subject and body in message, the simplest way is to type `git commit` without the `-m` flag and message argument.
Doing so will open a new Visual Studio Code tab if you had [set Visual Studio Code as the Git editor](https://www.theodinproject.com/lessons/foundations-git-basics#changing-the-git-commit-message-editor). You can remove any comments and enter your multi-line messages. When you save and close the tab, your commit will be created.

### Knowledge check

The following questions are an opportunity to reflect on key topics in this lesson. If you can't answer a question, click on it to review the material, but keep in mind you are not expected to memorize or master this knowledge.
Expand Down

0 comments on commit 89d4df6

Please sign in to comment.