🌍 Git & Version Control · subject

Git & Version Control Remote Repositories and Collaboration Syllabus

The Remote Repositories and Collaboration syllabus for Git & Version Control in full: 5 chapters and 20 topics, every one listed below, plus 51 Remote Repositories and Collaboration flashcards with answers.

5Chapters
20Topics
51Flashcards

Remote Repositories and Collaboration syllabus: all 5 chapters

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

  1. Working with Remotes

    4 topics
    • Adding and Inspecting Remotes
    • Fetching and Pulling
    • Pushing Changes
    • Tracking Remote Branches
  2. Authentication and Access

    4 topics
    • HTTPS vs SSH Authentication
    • Generating and Adding SSH Keys
    • Personal Access Tokens
    • Credential Managers and Caching
  3. The Forking Workflow

    3 topics
    • Forking a Repository
    • Keeping a Fork in Sync
    • Contributing to Open Source
  4. Pull Requests and Merge Requests

    5 topics
    • Anatomy of a Pull Request
    • Opening a Pull Request
    • Code Review Process
    • Merge Methods
    • Resolving PR Conflicts
  5. Team Collaboration Practices

    4 topics
    • Commit Message Conventions
    • Code Review Etiquette
    • Protected Branches and Required Reviews
    • Issue Tracking and Labels

Git & Version Control Remote Repositories and Collaboration flashcards — 51 questions with answers

  1. What is a "remote" in Git, and what is the default name given to the remote you cloned from?

    A remote is a named reference (a bookmark) to a version of your repository hosted elsewhere (e.g., on GitHub). When you clone a repository, Git automatically names that remote "origin".

  2. Which command adds a new remote named "upstream" pointing to a URL, and what is its general syntax?

    git remote add <name> <url>. Example: git remote add upstream https://github.com/original/repo.git

  3. How do you list all configured remotes together with their fetch and push URLs?

    git remote -v (the -v/--verbose flag shows the URLs; plain git remote lists only the names).

  4. Which command shows detailed information about a single remote, including its URL, tracked branches, and which local branches are configured to push/pull?

    git remote show <name> (e.g., git remote show origin).

  5. How do you rename a remote from "origin" to "github", and how do you delete a remote named "upstream"?

    Rename: git remote rename origin github. Delete: git remote remove upstream (or git remote rm upstream).

  6. How do you change the URL of an existing remote named "origin"?

    git remote set-url origin <new-url>.

  7. What is the key difference between git fetch and git pull?

    git fetch downloads new commits and updates remote-tracking branches but does NOT change your working branch. git pull does a fetch followed by a merge (or rebase) into your current branch, updating your working files.

  8. Express git pull as an equivalent combination of two other commands (default behavior).

    git pull origin main is equivalent to: git fetch origin followed by git merge origin/main.

  9. How do you make git pull rebase your local commits on top of the fetched work instead of creating a merge commit?

    Use git pull --rebase, or set it permanently with git config pull.rebase true (or globally with --global).

  10. What does the git fetch --prune (or git fetch -p) option do?

    It removes any remote-tracking references locally that no longer exist on the remote (i.e., deletes stale remote-tracking branches whose upstream branch was deleted).

  11. What is the general syntax to push a local branch to a remote?

    git push <remote> <branch>. Example: git push origin main pushes your local main to origin's main.

  12. What does the -u (or --set-upstream) flag do in git push -u origin main?

    It pushes the branch AND sets origin/main as the upstream (tracking) branch, so future git push and git pull can be run without specifying remote and branch.

  13. Why is git push --force dangerous, and what safer alternative should you prefer?

    --force overwrites the remote branch history and can destroy commits pushed by others. Prefer --force-with-lease, which refuses to overwrite if the remote has changes you haven't seen locally.

  14. How do you delete a remote branch named "feature-x" on the remote "origin"?

    git push origin --delete feature-x (equivalently git push origin :feature-x).

  15. What is a remote-tracking branch, and how is it named?

    A remote-tracking branch is a local read-only reference that mirrors the state of a branch on a remote. It is named <remote>/<branch>, e.g., origin/main. You cannot commit to it directly; it updates only via fetch/pull/push.

  16. What does it mean for a local branch to "track" a remote branch (an upstream branch)?

    A tracking branch has an associated upstream remote branch. Git then knows where to push/pull by default and can report ahead/behind status (e.g., "Your branch is ahead of origin/main by 2 commits").

  17. How do you set the upstream for an existing local branch already checked out?

    git branch --set-upstream-to=origin/main (or the shorthand git branch -u origin/main).

  18. Which command creates a new local branch that tracks a remote branch you fetched but don't yet have locally?

    git checkout -b feature origin/feature, or the shorthand git checkout feature (Git auto-creates a tracking branch if the name matches a single remote), or git switch -c feature --track origin/feature.

  19. Compare HTTPS and SSH as the two main protocols for authenticating with a remote Git host.

    HTTPS uses a URL like https://github.com/user/repo.git and authenticates with a username plus a password/token; it works through most firewalls and needs no key setup. SSH uses git@github.com:user/repo.git and authenticates with a public/private key pair; no password prompt per push once keys are set up.

  20. What does a typical SSH remote URL look like versus an HTTPS remote URL for GitHub?

    SSH: git@github.com:user/repo.git. HTTPS: https://github.com/user/repo.git.

Show the other 31 Remote Repositories and Collaboration flashcards
  1. Since August 2021, why can you no longer use your account password for Git operations over HTTPS on GitHub?

    GitHub removed password authentication for Git operations. Over HTTPS you must use a Personal Access Token (PAT) in place of the password; SSH keys are the alternative.

  2. Which command generates a new modern (Ed25519) SSH key pair, and what two files does it produce?

    ssh-keygen -t ed25519 -C "your_email@example.com". It produces a private key (e.g., ~/.ssh/id_ed25519) and a public key (~/.ssh/id_ed25519.pub).

  3. When adding an SSH key to GitHub, which of the two key files do you upload, and why never the other?

    You upload the PUBLIC key (the .pub file). The private key must NEVER be shared or uploaded; it stays on your machine and proves your identity.

  4. What is the purpose of the ssh-agent, and how do you add your key to it?

    ssh-agent holds your decrypted private key in memory so you don't retype the passphrase each time. Start it (eval "$(ssh-agent -s)") then add the key with ssh-add ~/.ssh/id_ed25519.

  5. How do you test that your SSH key is correctly configured with GitHub?

    Run ssh -T git@github.com. A successful setup returns a message like "Hi username! You've successfully authenticated, but GitHub does not provide shell access."

  6. What is a Personal Access Token (PAT), and what is it used in place of?

    A PAT is a generated secret string that acts as a credential for HTTPS Git operations and API access, used in place of your account password. It can be scoped to specific permissions and given an expiration date.

  7. What is the difference between a classic PAT and a fine-grained PAT on GitHub?

    A classic PAT grants broad scopes across all repositories you can access. A fine-grained PAT can be restricted to specific repositories and specific granular permissions, and always has a required expiration, making it more secure by least privilege.

  8. When cloning over HTTPS and prompted for a username and password, what should you enter for the password now?

    Enter your Personal Access Token (PAT) as the password, not your account password. The username is your GitHub username.

  9. What is a Git credential manager (credential helper), and what problem does it solve?

    A credential helper securely stores and retrieves your HTTPS credentials (username/PAT) so you don't re-enter them on every push/pull. Examples: Git Credential Manager (GCM), osxkeychain on macOS, cache, and store.

  10. Compare the "cache" and "store" credential helpers in Git.

    cache keeps credentials in memory for a limited time (default 15 minutes, configurable via --timeout) and never writes to disk. store saves credentials permanently in a plaintext file (~/.git-credentials), which is convenient but insecure.

  11. How do you configure Git to cache HTTPS credentials in memory for one hour?

    git config --global credential.helper 'cache --timeout=3600' (the timeout is given in seconds).

  12. What is "forking" a repository, and how does it differ from cloning?

    Forking creates a server-side copy of someone else's repository under your own account (on the host, e.g., GitHub). Cloning downloads a repository to your local machine. Typically you fork on GitHub, then clone your fork locally.

  13. In the standard fork-based contribution workflow, what do the remotes "origin" and "upstream" conventionally refer to?

    origin refers to YOUR fork (the copy under your account that you can push to). upstream refers to the ORIGINAL repository you forked from (which you usually cannot push to, only fetch from).

  14. List the sequence of commands to sync your fork's main branch with the upstream repository.

    git fetch upstream; git checkout main; git merge upstream/main (or git rebase upstream/main); then git push origin main to update your fork on the host.

  15. Why do you add an "upstream" remote after cloning your fork, and how?

    Because your fork does not automatically receive new commits from the original project. You add it so you can pull the latest changes: git remote add upstream <original-repo-url>.

  16. Outline the typical end-to-end workflow for contributing to an open-source project via a fork.

    1) Fork the repo on the host. 2) Clone your fork and add upstream. 3) Create a feature branch. 4) Make commits. 5) Push the branch to your fork (origin). 6) Open a Pull Request against the upstream repo. 7) Respond to review feedback. 8) Maintainer merges.

  17. Why is it best practice to create a dedicated feature branch (rather than working on main) when contributing to open source?

    It isolates your changes, keeps main clean and in sync with upstream, lets you work on multiple contributions simultaneously, and makes the pull request focused and easy to review or revise.

  18. What is a Pull Request (PR), also called a Merge Request in GitLab?

    A PR is a request to merge the commits from one branch (usually a feature/fork branch) into another branch (usually the project's main branch). It is a collaboration surface for review, discussion, automated checks, and approval before code is integrated.

  19. Name the key anatomical parts of a Pull Request.

    Title and description (summary of changes), source/head branch and target/base branch, the commit list, the file diff (changes), conversation/comments thread, review approvals/requested changes, linked issues, and status checks (CI/tests).

  20. What do the "base" branch and the "compare" (head) branch mean when opening a Pull Request?

    The base branch is the branch you want to merge INTO (the target, e.g., main). The compare/head branch is the one containing your new commits (the source, e.g., your feature branch).

  21. After pushing a new branch to your fork, what are the two common ways to open a Pull Request?

    Use the GitHub web UI (a "Compare & pull request" banner appears, or click New pull request and select base/compare branches), or use the GitHub CLI: gh pr create.

  22. What is a "draft" pull request and when would you use it?

    A draft PR signals that the work is in progress and not yet ready to merge; it cannot be merged until marked ready for review. Use it to get early feedback or run CI while still working.

  23. What is the purpose of the code review process on a pull request?

    To catch bugs, ensure code quality and consistency, verify the change meets requirements, share knowledge across the team, and maintain a shared standard before code is merged into the main branch.

  24. On GitHub, what are the three review outcomes a reviewer can submit?

    Comment (general feedback, no explicit approval or rejection), Approve (sign off that the changes are good to merge), and Request changes (block the merge until specified issues are addressed).

  25. Compare the three merge methods offered by GitHub: merge commit, squash and merge, and rebase and merge.

    Merge commit: keeps every commit and adds a merge commit, preserving full history. Squash and merge: combines all PR commits into a single new commit on the base, giving a clean linear history. Rebase and merge: replays each PR commit individually onto the base with no merge commit, keeping commits but linear.

  26. Which merge method produces a single combined commit, and which preserves each individual commit while keeping history linear?

    Squash and merge produces a single combined commit. Rebase and merge preserves each individual commit while keeping the history linear (no merge commit).

  27. What causes conflicts in a pull request, and generally how are they resolved?

    A PR conflict occurs when the base branch has changed the same lines that the PR branch modified, so Git cannot auto-merge. Resolve by merging or rebasing the latest base branch into the PR branch, editing the conflict markers (<<<<<<<, =======, >>>>>>>), committing the resolution, and pushing again.

  28. When resolving a merge conflict, what do the markers <<<<<<<, =======, and >>>>>>> delimit?

    <<<<<<< HEAD marks the start of your current branch's version, ======= separates the two versions, and >>>>>>> <branch> marks the end of the incoming branch's version. You edit to keep the desired content and delete all three markers.

  29. What is the recommended format of a conventional Git commit message (subject and body)?

    A short imperative subject line (about 50 characters, capitalized, no trailing period), a blank line, then a wrapped body (~72 chars/line) explaining WHAT and WHY (not how). Example subject: "Add user login validation."

  30. In the Conventional Commits specification, what is the message structure and what do types like feat and fix signify?

    Structure: type(optional scope): description, e.g., feat(auth): add OAuth login. feat = a new feature (bumps a MINOR version), fix = a bug fix (bumps a PATCH version). A ! or "BREAKING CHANGE:" footer denotes a breaking change (MAJOR). Other types: docs, style, refactor, test, chore.

  31. State three etiquette guidelines for giving good code review feedback.

    Be respectful and critique the code, not the person; explain the WHY behind requested changes and suggest concrete improvements; distinguish blocking issues from optional nits (e.g., prefix minor suggestions with "nit:"); acknowledge good work; and ask questions rather than making demands.

Git & Version Control Remote Repositories and Collaboration FAQ

What is in the Git & Version Control Remote Repositories and Collaboration syllabus?

Git & Version Control Remote Repositories and Collaboration is split into 5 chapters: Working with Remotes, Authentication and Access, The Forking Workflow, Pull Requests and Merge Requests and Team Collaboration Practices. Together they contain 20 topics.

How many chapters are in Git & Version Control Remote Repositories and Collaboration?

5 chapters, containing 20 topics. The largest chapter is Pull Requests and Merge Requests, with 5 topics.

Are there flashcards for Git & Version Control Remote Repositories and Collaboration?

Yes — a 51-card Remote Repositories and Collaboration 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.