Public Deck

Git Commands - Complete Reference

Master Git with 45 essential commands and workflows for version control, branching, collaboration, and recovering from mistakes.

AnyFlashcards45 cards

Preview

Front

How do you fetch changes from a remote and immediately merge them into your branch?

Back

git pull A combination of 'git fetch' and 'git merge'.

Front

How do you initialize a new local Git repository?

Back

git init Creates a new .git subdirectory in the current folder.

Front

How do you create a local copy of a remote repository?

Back

git clone <url> Downloads the entire repository history to your machine.

Front

How do you check the current state of the working directory and staging area?

Back

git status Shows which files are staged, unstaged, or untracked.

Front

How do you add a specific file to the staging area?

Back

git add <file> Prepares a specific file to be included in the next commit.

Front

How do you add all modified and new files to the staging area?

Back

git add . Stages all changes in the current directory and subdirectories.

Front

How do you record staged changes into the repository history?

Back

git commit -m "message" Creates a snapshot of the staged changes with a descriptive note.

Front

How do you view the commit history for the current branch?

Back

git log Lists the series of commits in reverse chronological order.

Front

How do you see changes in the working directory that are not yet staged?

Back

git diff Shows line-by-line differences between files and the last commit.

Front

How do you see changes that are staged but not yet committed?

Back

git diff --staged Compares the staging area with the most recent commit.

+ 35 more cards

Related Flashcard Decks

Ready to study?

Sign up for free to copy this deck and start learning with spaced repetition.

Get started for free