🌍 DevOps · subject

DevOps Version Control Systems Syllabus

The Version Control Systems syllabus for DevOps in full: 2 chapters and 8 topics, every one listed below, plus 49 Version Control Systems flashcards with answers.

2Chapters
8Topics
49Flashcards

Version Control Systems syllabus: all 2 chapters

Expand any chapter to see its topics and sub-topics.

  1. Git Basics

    4 topics
    • Installing Git
    • Basic Commands: init, clone, add, commit
    • Branching and Merging
    • Working with Remote Repositories
  2. Advanced Git

    4 topics
    • Rebasing vs Merging
    • Cherry-picking
    • Stashing and Cleaning
    • Git Hooks

DevOps Version Control Systems flashcards — 49 questions with answers

  1. What is Git, and what category of version control system does it belong to?

    Git is a free, open-source distributed version control system (DVCS). Every clone is a full repository with complete history, so it does not depend on a central server to function.

  2. On a Debian/Ubuntu Linux system, what command installs Git from the package manager?

    sudo apt-get install git (or sudo apt install git).

  3. After installing Git, which two commands set your global identity for commits?

    git config --global user.name "Your Name" and git config --global user.email "you@example.com".

  4. How do you verify the installed Git version?

    Run git --version, which prints the installed version (e.g., git version 2.x.x).

  5. Where does Git store global configuration set with --global, and where is repository-specific config stored?

    Global config is stored in ~/.gitconfig (the user's home directory). Repository-local config is stored in .git/config inside the repo. Local overrides global, which overrides system (/etc/gitconfig).

  6. What does git init do?

    It creates a new, empty Git repository in the current directory by generating a hidden .git subdirectory that holds all objects, refs, and metadata.

  7. What does git clone do?

    It copies an existing repository (and its full history) from a remote URL to your local machine, creates a working copy, and automatically sets up a remote named 'origin' tracking the source.

  8. What is the purpose of git add?

    It stages changes — copying modified or new files from the working directory into the staging area (index) so they will be included in the next commit.

  9. What does git commit do, and what does -m provide?

    git commit records the staged snapshot as a permanent object in the repository history. The -m flag provides the commit message inline, e.g., git commit -m "message".

  10. What are the three main states/areas a file moves through in Git's basic workflow?

    Working directory (modified files) → Staging area / index (git add) → Repository / committed history (git commit). The states are: modified, staged, and committed.

  11. What does git status show?

    It shows the current state of the working directory and staging area: which files are untracked, modified, or staged, and the current branch and its relation to the upstream.

  12. What is the difference between git add . and git add -A?

    git add . stages new and modified files in the current directory and below (and, in modern Git, deletions too). git add -A stages all changes across the entire repository (new, modified, and deleted), regardless of current directory.

  13. What is a Git branch, technically?

    A branch is simply a lightweight, movable pointer to a specific commit. The default branch is usually named main (formerly master), and HEAD points to the current branch.

  14. Which command creates a new branch and switches to it in one step?

    git checkout -b <branch> or, in newer Git, git switch -c <branch>.

  15. What does git merge do?

    It integrates changes from one branch into the current branch, combining their histories. Git creates a merge commit (unless a fast-forward is possible) that has two parent commits.

  16. What is a fast-forward merge?

    When the target branch has not diverged, Git simply moves the branch pointer forward to the source branch's commit instead of creating a merge commit, because no integration work is needed.

  17. What is a merge conflict and when does it occur?

    A conflict occurs when two branches modify the same lines of a file (or one edits while the other deletes) and Git cannot automatically reconcile them. Git marks the conflicting regions with <<<<<<<, =======, and >>>>>>> for manual resolution.

  18. After manually resolving a merge conflict in a file, what steps complete the merge?

    Stage the resolved file with git add <file>, then finalize with git commit (or git merge --continue).

  19. What does git branch -d differ from git branch -D?

    git branch -d <branch> safely deletes a branch only if it has been merged. git branch -D force-deletes it even if it contains unmerged commits.

  20. What is a remote repository in Git?

    A remote is a version of the project hosted elsewhere (e.g., on GitHub or a server), referenced by a name (default 'origin') and URL, used to share and synchronize commits with collaborators.

Show the other 29 Version Control Systems flashcards
  1. What does git remote add origin <url> do?

    It registers a new remote named 'origin' pointing at the given URL, so you can push to and fetch from that repository by name.

  2. What is the difference between git fetch and git pull?

    git fetch downloads new commits and refs from the remote but does NOT modify your working branch. git pull is effectively git fetch followed by git merge (or rebase), integrating the changes into your current branch.

  3. What does git push -u origin main accomplish?

    It uploads local commits on main to the remote 'origin' and the -u (--set-upstream) flag records origin/main as the tracking branch, so future git push/pull can be run without arguments.

  4. What is a tracking (upstream) branch?

    A local branch that has a direct relationship to a remote branch (e.g., main tracks origin/main). It lets Git report ahead/behind status and lets push/pull default to the right remote branch.

  5. What does git rebase do conceptually?

    It reapplies (replays) a series of commits from your branch onto a new base commit, producing a linear history as if you had branched from that newer base. It rewrites commit hashes.

  6. State the core conceptual difference between merging and rebasing.

    Merge is non-destructive: it preserves the true branch history and creates a merge commit joining two lines. Rebase rewrites history to produce a linear sequence, moving commits onto a new base and giving them new hashes.

  7. Why should you avoid rebasing commits that have already been pushed/shared?

    Rebasing rewrites commit hashes and history. If others have based work on the original commits, rewriting them causes divergence and forces disruptive history reconciliation (the 'golden rule of rebasing': never rebase public/shared branches).

  8. What is the command to interactively rebase the last 3 commits?

    git rebase -i HEAD~3, which opens an editor to reorder, squash, edit, or drop those commits.

  9. What is the trade-off summarized as merge vs rebase for history?

    Merge keeps complete, true history but adds merge commits (more cluttered, non-linear). Rebase yields clean linear history but rewrites commits and loses the exact context of when work diverged.

  10. What does git cherry-pick do?

    It applies the changes introduced by one (or more) specific existing commit(s) onto the current branch, creating a new commit with the same content but a different hash.

  11. Give a typical use case for cherry-picking.

    Applying a specific bug-fix commit from one branch to another (e.g., backporting a hotfix to a release branch) without merging the entire source branch.

  12. What is the command to cherry-pick a commit without immediately committing it?

    git cherry-pick -n <commit> (or --no-commit), which applies the changes to the working tree/index but lets you commit manually.

  13. What does git stash do?

    It temporarily shelves (saves) uncommitted changes in the working directory and index, reverting the working tree to a clean HEAD state, so you can switch context without committing.

  14. How do you reapply the most recent stash, and what is the difference between git stash pop and git stash apply?

    git stash pop reapplies the most recent stash and removes it from the stash list. git stash apply reapplies it but keeps it in the stash list for reuse.

  15. How do you list saved stashes and apply a specific one?

    git stash list shows all stashes (e.g., stash@{0}, stash@{1}). Apply a specific one with git stash apply stash@{n} (or pop stash@{n}).

  16. By default, does git stash include untracked files? How do you include them?

    No, by default git stash only saves tracked, modified files. Use git stash -u (--include-untracked) to also stash untracked files, or -a (--all) to include ignored files as well.

  17. What does git clean do, and why is the -n flag important?

    git clean removes untracked files from the working directory. The -n (--dry-run) flag previews what would be deleted without removing anything, which is important because the deletion is not recoverable via Git.

  18. What does git clean -fd do?

    It forcibly (-f) removes untracked files and also removes untracked directories (-d). The -f flag is required because Git refuses to clean by default for safety.

  19. What is a Git hook?

    A Git hook is a script that Git automatically executes when certain repository events occur (e.g., committing, merging, pushing), allowing you to automate or enforce custom actions and policies.

  20. Where are Git hooks stored, and are they shared via the repository by default?

    They live in the .git/hooks directory of a repository. By default they are local and NOT copied/cloned with the repo, so they are not shared automatically (tools like a tracked hooks dir or pre-commit framework are used to share them).

  21. What is the difference between client-side and server-side hooks?

    Client-side hooks run on the developer's machine for actions like committing and merging (e.g., pre-commit, prepare-commit-msg, post-merge). Server-side hooks run on the remote receiving pushes (e.g., pre-receive, update, post-receive) to enforce policies.

  22. What does the pre-commit hook do and a common use for it?

    It runs before a commit is finalized; if it exits non-zero, the commit is aborted. It is commonly used to run linters, formatters, or tests to reject substandard commits.

  23. What does the commit-msg hook do?

    It runs after the commit message is entered and receives the path to the message file; it can validate or enforce message format (e.g., requiring a ticket number or conventional-commit style) and abort the commit if invalid.

  24. What must a hook script have to actually run?

    It must be named exactly the hook name (no extension, e.g., pre-commit) inside .git/hooks and must be executable (chmod +x). Sample hooks ship with a .sample suffix, which disables them.

  25. What is the difference between git reset and git revert?

    git reset moves the branch pointer (and optionally the index/working tree) to a previous commit, rewriting/removing later history locally. git revert creates a new commit that undoes a previous commit's changes, preserving history (safe for shared branches).

  26. What do git reset --soft, --mixed, and --hard each affect?

    --soft moves HEAD only (keeps index and working tree, changes left staged). --mixed (default) moves HEAD and resets the index (changes left unstaged). --hard moves HEAD and resets both index and working tree, discarding changes.

  27. What is HEAD in Git?

    HEAD is a reference (pointer) to the currently checked-out commit, normally pointing to the tip of the current branch. A 'detached HEAD' means it points directly at a commit rather than a branch.

  28. What is the purpose of a .gitignore file?

    It specifies intentionally untracked file patterns that Git should ignore (e.g., build artifacts, secrets, logs), preventing them from being staged or committed. It does not affect files already tracked.

  29. How can you view the commit history compactly as one line per commit?

    git log --oneline, which shows each commit as an abbreviated hash plus the commit summary; adding --graph --all visualizes branch and merge structure.

DevOps Version Control Systems FAQ

What is in the DevOps Version Control Systems syllabus?

DevOps Version Control Systems is split into 2 chapters: Git Basics and Advanced Git. Together they contain 8 topics.

How many chapters are in DevOps Version Control Systems?

2 chapters, containing 8 topics. The largest chapter is Git Basics, with 4 topics.

Are there flashcards for DevOps Version Control Systems?

Yes — a 49-card Version Control Systems deck, printed in full in the flashcards section of this page and available in the Examius app with spaced repetition. The free plan covers one exam of your choice, including its flashcards; Examius Pro, a one-time purchase, unlocks every other exam and deck.