0
0
Gitdevops~30 mins

Writing good commit messages in Git - Mini Project: Build & Apply

Choose your learning style9 modes available
Writing Good Commit Messages
📖 Scenario: You are working on a small project with your friend. You want to keep track of your changes clearly so both of you understand what was done and why. Writing good commit messages helps everyone on the team stay organized and makes it easier to find changes later.
🎯 Goal: Learn how to write clear and helpful git commit messages by creating commits with specific messages following best practices.
📋 What You'll Learn
Create a git repository
Make a file change
Write a commit message with a short summary
Add a detailed description in the commit message body
Use proper formatting for commit messages
💡 Why This Matters
🌍 Real World
Writing clear commit messages is like keeping a diary of your work. It helps you and your team remember what was done and why, making collaboration smoother.
💼 Career
Employers expect developers to write meaningful commit messages. This skill improves teamwork, code reviews, and project maintenance.
Progress0 / 4 steps
1
Initialize Git Repository and Create a File
Initialize a new git repository in your current folder by running git init. Then create a file called README.md with the exact content # Project Title.
Git
Need a hint?

Use git init to start a new repository. Use echo or a text editor to create README.md with the exact text.

2
Add the File and Prepare to Commit
Add the file README.md to the git staging area using git add README.md. This prepares the file to be committed.
Git
Need a hint?

Use git add README.md to stage the file for commit.

3
Write a Commit with a Short Summary
Create a commit with the message Initial commit using git commit -m "Initial commit". This message is a short summary of the change.
Git
Need a hint?

Use git commit -m "Your message" to commit with a short message.

4
Write a Commit with a Detailed Message
Modify the README.md file by adding the line Project description goes here.. Then add the file again with git add README.md. Finally, create a commit with a detailed message using git commit -m "Add project description" -m "Added a description line to README.md to explain the project purpose.". The first -m is the short summary, the second -m is the detailed body.
Git
Need a hint?

Use echo with >> to append text. Use two -m options in git commit for short and detailed messages.