Lab: Learn git commands
Objective
In this lab, we will learn how to perform the following activities:
- Create the repository
- Connect to the repository
- Create a branch
- Change the branch
- Stage the changes
- Commit the changes
- Pull the changes
- Create a pull request
- Peer review the code
- Merge the branches
- Create the issues
Process Flow
Git Commands
NOTE
In Mac/Linux, Bash comes pre-installed. And in Windows, git will also install bash terminal.
Quiz
Which git command sets up a git tracking of a project?
- A. init
- B. status
- C. add
- D. commit
Show answer
A. This initializes a git respository.
Which git command is used to tell git to track a file
- A. init
- B. status
- C. add
- D. commit
Show answer
C. This adds a file to gits control.
Which git command is used to record changes?
- A. init
- B. status
- C. add
- D. commit
Show answer
D. This records tracked changes.
Which git command is used to switch branches?
- A. log
- B. diff
- C. checkout
- D. merge
Show answer
C. Yes, this changes to the specified branch.