Post

09 - Student Worksheet (Fill-in + Exercises)

#09 - Student Worksheet (Fill-in + Exercises)

Name: ________ Date: ________ Batch: ________

##Part A - Core Concepts

Fill in the blanks.

  1. Git command used to check current state: ________
  2. Area where selected changes are kept before commit: ________
  3. Command that records staged changes into history: ________
  4. Command to see unstaged line-by-line changes: ________
  5. File used to ignore temporary files: ________

Short answers.

  1. Explain untracked file in one sentence:

  1. Explain difference between working directory and staging area:

##Part B - Command Practice

Create your practice directory and initialize git.

1
2
3
4
mkdir git_worksheet
cd git_worksheet
touch a_file
git init

Task 1: Initial commit

Write the commands you used:

1

Task 2: Add first line to a_file and commit

Write the commands you used:

1

Task 3: Add second line to a_file and view history

Write the commands you used:

1

##Part C - Mistake Recovery

Scenario 1: You staged b_file and c_file, but only b_file should be committed.

Write the unstage command for c_file:

1

Scenario 2: You accidentally committed c_file. You want to go back to previous correct commit but keep changes available.

  1. Command to move HEAD to previous correct commit while keeping changes staged:
1
  1. Command to unstage c_file:
1

##Part D - Remote Workflow

Fill in commands.

  1. Add remote named origin:
1
git remote add origin ____________________
  1. Push and set upstream for main:
1
____________________
  1. Download latest remote references without merging:
1
____________________
  1. Pull latest changes:
1
____________________

##Part E - vi Practice

Open file in vi:

1
vi notes.txt

Complete this checklist.

  • Enter insert mode using key: ________
  • Return to normal mode using key: ________
  • Save command: ________
  • Save and quit command: ________
  • Quit without saving command: ________
  • Delete current line command: ________
  • Undo command: ________
  • Search command format: ________

##Part F - Mini Challenge (Instructor Check)

Perform all tasks and ask trainer to verify.

  1. Create a repository.
  2. Make 2 commits to same file.
  3. Add .gitignore and ignore one temp file.
  4. Stage wrong file and unstage correctly.
  5. Open vi, add one line, save and quit.

Trainer signature: ________

##Reflection

  1. The command I found most useful today:

  1. The command I need to practice more:

  1. One real project scenario where Git history helps:

This post is licensed under CC BY 4.0 by the author.