D1: Essential Git Commands
GH-900 GitHub Foundations exam practice questions · 12 flashcards
Question
git init?
1 / 12
Tip: Space flips the card, ← / → navigate.
Show all 12 Essential Git Commands practice questions and answers
- git init?Creates a new Git repository in the current folder.
- git clone <url>?Copies a remote repository with full history to your machine.
- git status?Shows modified, staged and untracked files.
- git add <file>?Stages changes for the next commit.
- git commit -m "msg"?Records staged changes as a new commit.
- git log?Shows commit history.
- git branch <name> / git switch <name>?Create a branch / switch to it (git switch -c creates and switches).
- git checkout?Older command to switch branches or restore files.
- git remote -v?Lists configured remotes.
- git revert <sha>?Creates a new commit that undoes a previous commit (safe for shared history).
- git reset?Moves branch pointer/unstages changes; --hard discards local changes (dangerous).
- git stash?Temporarily shelves uncommitted changes.