Back to courses
Part 1: Original Categories — Revised (courses 1–2660) beginner

Git and version control: a serious guide

Duration0 hours
Modules7
ForGeneral public, lifelong learners
Video1-2min
Get started — free →

Course outline

Module 1 Module 1: Introduction to Git and Version Control

Introduction to Git and Version Control

Introduction

Core content I

Core content II

Core content III

Summary

Further learning

Knowledge check

Q1. What is the primary purpose of version control?
  • A. To track changes in files over time ✓
  • B. To manage project documentation
  • C. To increase the speed of code execution
  • D. To compile code faster

Why: Version control is primarily used to track changes in files over time, allowing multiple people to collaborate on a project efficiently.

Q2. Which of the following is a version control system?
  • A. GitHub
  • B. Git
  • C. Bitbucket
  • D. All of the above ✓

Why: Git is a version control system, and GitHub and Bitbucket are platforms that use Git for version control.

Q3. What does Git do when you commit changes?
  • A. It sends the changes to a remote server
  • B. It saves the changes in a local repository ✓
  • C. It deletes the changes from your working directory
  • D. It ignores the changes

Why: When you commit changes in Git, it saves the changes in a local repository, creating a snapshot of your project's state at that point in time.

Q4. What is a repository in Git?
  • A. A folder containing project files
  • B. A remote server where code is stored
  • C. A database of all changes made to a project
  • D. A collection of commits and files ✓

Why: A repository in Git is a collection of commits and files that represent the history and current state of a project.

Q5. What is the command to initialize a new Git repository?
  • A. git start
  • B. git init ✓
  • C. git new
  • D. git create

Why: The command 'git init' is used to initialize a new Git repository, creating a .git directory where Git stores all version control data.

Module 2 Module 2: Setting Up Git and Your First Commit

Setting Up Git and Your First Commit

Introduction

Core content I

Core content II

Core content III

Summary

Further learning

Knowledge check

Q1. What command is used to initialize a new Git repository?
  • A. git start
  • B. git init ✓
  • C. git new
  • D. git setup

Why: The 'git init' command initializes a new Git repository.

Q2. Which file is created when you run 'git init'?
  • A. .gitignore
  • B. README.md
  • C. .git ✓
  • D. package.json

Why: The '.git' directory is created when you initialize a new Git repository.

Q3. What does the 'git add' command do?
  • A. Commits changes to the repository
  • B. Removes files from the repository
  • C. Stages changes for the next commit ✓
  • D. Pushes changes to a remote server

Why: The 'git add' command stages changes for the next commit.

Q4. Which command is used to create the first commit in a Git repository?
  • A. git commit ✓
  • B. git firstcommit
  • C. git initial
  • D. git create

Why: The 'git commit' command is used to create a commit in a Git repository.

Q5. What is the purpose of the 'git status' command?
  • A. To view the commit history
  • B. To check the current status of the working directory and staging area ✓
  • C. To push changes to a remote repository
  • D. To create a new branch

Why: The 'git status' command checks the current status of the working directory and staging area.

Module 3 Module 3: Branching and Merging in Git

Branching and Merging in Git

Introduction

Core content I

Core content II

Core content III

Summary

Further learning

Knowledge check

Q1. What is the primary purpose of branching in Git?
  • A. To create a new repository
  • B. To develop features or fixes in isolation ✓
  • C. To merge changes from one branch to another
  • D. To delete old commits

Why: Branching allows developers to work on new features, experiments, or bug fixes without affecting the main codebase until the changes are ready to be merged.

Q2. Which command is used to create a new branch in Git?
  • A. git branch ✓
  • B. git checkout
  • C. git merge
  • D. git commit

Why: The 'git branch' command is used to create a new branch in Git.

Q3. What happens when you run 'git checkout -b feature-1'?
  • A. It creates a new branch called 'feature-1' and switches to it ✓
  • B. It deletes the current branch
  • C. It merges 'feature-1' into the current branch
  • D. It commits changes to 'feature-1'

Why: The command 'git checkout -b feature-1' creates a new branch called 'feature-1' and switches to it.

Q4. Which Git command is used to merge changes from one branch into another?
  • A. git branch
  • B. git checkout
  • C. git merge ✓
  • D. git commit

Why: The 'git merge' command is used to merge changes from one branch into another.

Q5. What is the default branch name in a new Git repository?
  • A. main ✓
  • B. master
  • C. develop
  • D. trunk

Why: The default branch name in a new Git repository is typically 'main', though some repositories may still use 'master'.

Module 4 Module 4: Exploring Git History and Logs

Exploring Git History and Logs

Introduction

Core content I

Core content II

Core content III

Summary

Further learning

Knowledge check

Q1. What command is used to view the commit history in Git?
  • A. git history
  • B. git log ✓
  • C. git show
  • D. git commit

Why: "git log" is the primary command used to explore Git history and view commit logs.

Q2. Which of the following options displays a single line summary of each commit in Git log?
  • A. --oneline ✓
  • B. --summary
  • C. --brief
  • D. --short

Why: The "--oneline" option in git log displays each commit as a single line summary.

Q3. What does the git log --graph option do?
  • A. Shows the commit history in a graph format ✓
  • B. Shows the commit history in a table format
  • C. Shows the commit history in a list format
  • D. Shows the commit history in a tree format

Why: The "--graph" option in git log visualizes the commit history as a graph, showing branches and merges.

Q4. Which Git command allows you to view the changes made in a specific commit?
  • A. git show ✓
  • B. git log
  • C. git diff
  • D. git status

Why: The "git show" command is used to view the changes made in a specific commit, including the commit message and diff.

Q5. What does the git log --author="John Doe" command do?
  • A. Shows commits made by John Doe
  • B. Shows commits related to John Doe
  • C. Shows commits with the author name John Doe ✓
  • D. Shows commits where John Doe is mentioned

Why: The "--author" option filters commits by the author's name, showing only those made by "John Doe".

Module 5 Module 5: Collaborating with Git and Remote Repositories

Collaborating with Git and Remote Repositories

Introduction

Core content I

Core content II

Core content III

Summary

Further learning

Knowledge check

Q1. What command is used to push changes from your local repository to a remote repository?
  • A. git pull
  • B. git push ✓
  • C. git commit
  • D. git clone

Why: git push is used to send your local commits to a remote repository.

Q2. Which command is used to fetch changes from a remote repository but not merge them into your local branch?
  • A. git pull
  • B. git fetch ✓
  • C. git merge
  • D. git commit

Why: git fetch retrieves changes from a remote repository without merging them into your local branch.

Q3. What does the term 'origin' refer to in Git?
  • A. A local branch
  • B. The default name for a remote repository ✓
  • C. A commit hash
  • D. A file in the working directory

Why: 'origin' is the default name assigned to the remote repository when you clone it.

Q4. Which command allows you to view the status of your working directory and staging area?
  • A. git status ✓
  • B. git log
  • C. git diff
  • D. git branch

Why: git status shows the current state of your working directory and staging area.

Q5. What is the purpose of the 'git remote add' command?
  • A. To create a new branch
  • B. To add a remote repository to your local Git configuration ✓
  • C. To push changes to a remote repository
  • D. To view the commit history

Why: git remote add is used to add a remote repository to your local Git configuration.

Module 6 Module 6: Resolving Conflicts in Git

Resolving Conflicts in Git

Introduction

Core content I

Core content II

Core content III

Summary

Further learning

Knowledge check

Q1. What happens when two developers make conflicting changes to the same file in Git?
  • A. Git automatically merges the changes
  • B. Git marks the conflict and requires manual resolution ✓
  • C. Git discards the changes made by one of the developers
  • D. Git throws an error and stops the process

Why: When there are conflicting changes, Git cannot automatically resolve them and requires the developer to manually resolve the conflict.

Q2. Which command is used to view the files that have conflicts after a merge?
  • A. git status ✓
  • B. git log
  • C. git diff
  • D. git merge

Why: The git status command shows the current state of the working directory, including files with conflicts.

Q3. What does the '<<<<<<<', '=======', and '>>>>>>> HEAD' notation represent in a conflict?
  • A. It represents the start and end of a merge commit
  • B. It represents the conflict markers indicating the areas of conflict ✓
  • C. It represents the changes made by the remote branch
  • D. It represents the changes made by the local branch

Why: These markers are used by Git to indicate the areas of conflict in the file, helping the user resolve them manually.

Q4. Which command is used to mark a conflict as resolved in Git?
  • A. git resolve
  • B. git commit
  • C. git add ✓
  • D. git merge

Why: After resolving a conflict, the file must be staged using git add to mark it as resolved.

Q5. What should you do after resolving a conflict in Git?
  • A. Run git merge again
  • B. Run git commit
  • C. Run git add to stage the resolved file ✓
  • D. Run git push

Why: After resolving a conflict, you need to stage the resolved file using git add before committing the changes.

Module 7 Module 7: Best Practices and Advanced Git Tips

Best Practices and Advanced Git Tips

Introduction

Core content I

Core content II

Core content III

Summary

Further learning

Knowledge check

Q1. What is the primary purpose of using Git hooks?
  • A. To automate deployment processes
  • B. To enforce code quality and automate tasks before or after events in the Git workflow ✓
  • C. To manage remote repositories
  • D. To create branches

Why: Git hooks allow you to run custom scripts at specific points in the Git workflow, such as before committing or pushing, which helps enforce code quality and automate tasks.

Q2. Which command is used to view the history of changes in a Git repository?
  • A. git view
  • B. git log ✓
  • C. git history
  • D. git show

Why: The 'git log' command is used to view the history of changes in a Git repository, displaying a list of commits with details such as author, date, and message.

Q3. What does the 'git rebase' command do?
  • A. It merges two branches
  • B. It rewrites the commit history by moving or combining commits ✓
  • C. It creates a new branch
  • D. It deletes a branch

Why: The 'git rebase' command rewrites the commit history by moving or combining commits, allowing for a cleaner and more linear history.

Q4. Which Git configuration setting is used to set the default text editor?
  • A. git config --global core.editor ✓
  • B. git config --global user.editor
  • C. git config --global editor.default
  • D. git config --global default.editor

Why: The 'git config --global core.editor' setting is used to set the default text editor that Git will use for commit messages and other text-based operations.

Q5. What is the purpose of the 'git stash' command?
  • A. To delete uncommitted changes
  • B. To temporarily save changes that are not yet committed ✓
  • C. To push changes to a remote repository
  • D. To create a new branch

Why: The 'git stash' command is used to temporarily save changes that are not yet committed, allowing you to switch branches or perform other tasks without losing your work.

Stay in the loop on this course.

We’ll email you when new modules or related material drops. No spam.

Built with Fragment Language. Sovereign architecture — no third-party trackers.
FragRun.mfgAFImemoryFGOwnership: B-Systems.ee