0
0
Gitdevops~15 mins

git add for staging files - Mini Project: Build & Apply

Choose your learning style9 modes available
Using git add to Stage Files
📖 Scenario: You are working on a small project and have created some new files and modified existing ones. Before you can save these changes in your project history, you need to stage them using git add. This is like putting your work into a basket before officially saving it.
🎯 Goal: Learn how to use git add to stage specific files and all files in your project directory.
📋 What You'll Learn
Create two new files named index.html and style.css.
Modify an existing file named README.md.
Use git add to stage the file index.html.
Use git add to stage all changed files.
Use git status to verify staged files.
💡 Why This Matters
🌍 Real World
Staging files with <code>git add</code> is a key step before saving changes in version control. It helps you control exactly what changes you want to save.
💼 Career
Understanding how to stage files is essential for software developers, DevOps engineers, and anyone working with code repositories to manage project history safely.
Progress0 / 4 steps
1
Create new files and modify README.md
Create two new files named index.html and style.css. Also, modify the existing file README.md by adding the line "Project started" at the end.
Git
Need a hint?

Use echo commands to create and modify files.

2
Stage the file index.html using git add
Use the command git add index.html to stage only the file index.html.
Git
Need a hint?

Use git add index.html to stage that specific file.

3
Stage all changed files using git add
Use the command git add . to stage all changed files including style.css and README.md.
Git
Need a hint?

Use git add . to stage all files in the current directory.

4
Check staged files with git status
Use the command git status to display the list of staged files and verify that index.html, style.css, and README.md are staged.
Git
Need a hint?

Run git status to see which files are staged for commit.