0
0
Gitdevops~30 mins

Why version control matters in Git - See It in Action

Choose your learning style9 modes available
Why Version Control Matters
📖 Scenario: You are working on a simple text file project with a friend. You want to keep track of changes so you can see what was added or fixed and avoid losing work.
🎯 Goal: Learn how to create a git repository, add a file, commit changes, and see the history of changes to understand why version control is important.
📋 What You'll Learn
Create a new git repository
Add a file named notes.txt with initial content
Commit the file with a message
Make a change to notes.txt and commit again
View the commit history
💡 Why This Matters
🌍 Real World
Version control is used by developers to keep track of changes in code and documents. It helps teams work together without overwriting each other's work.
💼 Career
Knowing git is essential for software development, DevOps, and many IT roles. It shows you can manage projects safely and collaborate with others.
Progress0 / 4 steps
1
Initialize a Git Repository and Create a File
Run the command git init to create a new git repository. Then create a file named notes.txt with the exact content Hello, this is my first note.
Git
Need a hint?

Use git init to start version control in your folder. Use echo to create the file with the exact text.

2
Add the File to Git and Commit
Use git add notes.txt to stage the file. Then commit it with the message Initial commit with notes.txt using git commit -m.
Git
Need a hint?

Use git add to tell git which files to track. Use git commit -m "message" to save a snapshot with a message.

3
Modify the File and Commit the Change
Add the line This is an added line. to notes.txt. Then stage and commit this change with the message Added a new line to notes.txt.
Git
Need a hint?

Use >> to append a line to the file. Then add and commit the change with a clear message.

4
View the Commit History
Run the command git log --oneline to see the list of commits with their messages.
Git
Need a hint?

The git log --oneline command shows a short list of commits with their messages. You should see both commits listed.