Version control is a system that records changes to files over time so you can recall specific versions later. It helps teams work together and keeps track of every change made.
Click to reveal answer
beginner
What is Git?
Git is a popular version control system that helps manage changes in files and coordinate work among multiple people. It stores snapshots of your project and allows easy switching between versions.
Click to reveal answer
beginner
Explain the concept of a 'commit' in Git.
A commit is like saving a snapshot of your project at a certain point. It records what changes were made and allows you to go back to that state if needed.
Click to reveal answer
intermediate
What is a branch in Git?
A branch is like a separate path or workspace where you can make changes without affecting the main project. It lets you try new ideas safely and merge them back later.
Click to reveal answer
beginner
Why is version control important for teamwork?
Version control helps teams work together by tracking who made changes, preventing conflicts, and allowing easy merging of everyone's work. It keeps the project organized and safe.
Click to reveal answer
What does a 'commit' in Git represent?
AA deleted file
BA new project folder
CA saved snapshot of changes
DA user account
✗ Incorrect
A commit saves a snapshot of your project changes at a specific time.
Which of the following best describes a 'branch' in Git?
AA separate line of development
BA backup copy of the entire project
CA deleted version
DA user profile
✗ Incorrect
A branch is a separate line of development to work on changes independently.
Why do teams use version control systems like Git?
ATo create new programming languages
BTo track changes and collaborate safely
CTo speed up the internet
DTo delete old files automatically
✗ Incorrect
Version control helps teams track changes and work together without conflicts.
What happens when you 'merge' branches in Git?
AYou reset the project to the first version
BYou delete all branches
CYou create a new branch
DYou combine changes from different branches
✗ Incorrect
Merging combines changes from different branches into one.
Which command is used to save changes in Git?
Agit commit
Bgit save
Cgit push
Dgit branch
✗ Incorrect
The 'git commit' command saves a snapshot of your changes.
Explain how version control helps when multiple people work on the same project.
Think about how you can keep everyone's work organized and safe.
You got /4 concepts.
Describe the process and purpose of creating and merging branches in Git.
Imagine working on a new idea without disturbing the main project.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of using version control systems like Git?
easy
A. To speed up the computer's processor
B. To create graphics and animations
C. To delete old files automatically
D. To save and track changes to files over time
Solution
Step 1: Understand version control basics
Version control systems keep a history of changes made to files, allowing users to track and manage edits.
Step 2: Compare options to purpose
Only To save and track changes to files over time describes saving and tracking changes, which matches the main purpose of Git.
Final Answer:
To save and track changes to files over time -> Option D
Quick Check:
Version control = save and track changes [OK]
Hint: Version control = saving drafts of your work [OK]
Common Mistakes:
Confusing version control with speeding up hardware
Thinking it deletes files automatically
Assuming it creates graphics
2. Which Git command is used to start a new repository in your project folder?
easy
A. git init
B. git commit
C. git add
D. git push
Solution
Step 1: Identify command purpose
git init creates a new Git repository in the current folder, starting version control.
Step 2: Check other commands
git add stages files, git commit saves changes, and git push sends changes to a remote repository.
Final Answer:
git init -> Option A
Quick Check:
Start repo = git init [OK]
Hint: Initialize repo with git init command [OK]
Common Mistakes:
Using git add to start a repo
Confusing git commit with git init
Thinking git push starts a repo
3. What will happen after running these commands in order?
B. A new repository is created and file.txt is saved in the first commit
C. The repository is deleted
D. file.txt is deleted from the folder
Solution
Step 1: Analyze each command
git init creates a new repo, git add file.txt stages the file, and git commit saves the staged file as a commit.
Step 2: Understand the result
The file is saved in the repository history as the first commit; nothing is deleted or ignored.
Final Answer:
A new repository is created and file.txt is saved in the first commit -> Option B
Quick Check:
Init + add + commit = save file in repo [OK]
Hint: Init, add, commit = save file snapshot [OK]
Common Mistakes:
Thinking commit deletes files
Confusing add with delete
Assuming file is ignored automatically
4. You ran git commit -m "Update" but got an error saying "nothing to commit". What is the likely cause?
medium
A. You did not stage any files with git add
B. You forgot to run git init
C. You typed the commit message incorrectly
D. Your files are deleted
Solution
Step 1: Understand the error message
"Nothing to commit" means Git sees no changes staged to save.
Step 2: Identify missing step
Before committing, files must be staged with git add. Without staging, commit has nothing to save.
Final Answer:
You did not stage any files with git add -> Option A
Quick Check:
Commit needs staged files [OK]
Hint: Stage files with git add before commit [OK]
Common Mistakes:
Skipping git add before commit
Assuming commit message typo causes this error
Thinking files are deleted
5. You want to save changes to two files, index.html and style.css, but only index.html should be included in the commit. Which sequence of commands achieves this?
hard
A. git commit -m "Update index"
B. git add .
git commit -m "Update index"
C. git add index.html
git commit -m "Update index"
D. git add style.css
git commit -m "Update index"
Solution
Step 1: Stage only the desired file
Using git add index.html stages only that file, excluding others.
Step 2: Commit staged changes
git commit -m "Update index" saves only the staged index.html changes.