# Master Version Control with Git Flashcards

Table of Contents

Git Flashcards

What is Git?   drill git

Front

What is Git?

Back

Git is a distributed version control system for tracking changes in source code during software development.

Initialize a new Git repository   drill git

Front

How do you initialize a new Git repository?

Back

Use the command: git init

Clone a repository   drill git

Front

How do you clone a Git repository?

Back

Use the command: git clone [repository URL]

Check status of working directory   drill git

Front

How do you check the status of your working directory in Git?

Back

Use the command: git status

Stage changes   drill git

Front

How do you stage changes in Git?

Back

Use the command: git add [file] To stage all changes: git add .

Commit changes   drill git

Front

How do you commit changes in Git?

Back

Use the command: git commit -m "Commit message"

Push changes to remote repository   drill git

Front

How do you push changes to a remote repository in Git?

Back

Use the command: git push [remote] [branch] Example: git push origin main

Pull changes from remote repository   drill git

Front

How do you pull changes from a remote repository in Git?

Back

Use the command: git pull [remote] [branch] Example: git pull origin main

Create a new branch   drill git

Front

How do you create a new branch in Git?

Back

Use the command: git branch [branch-name] To create and switch to the new branch: git checkout -b [branch-name]

Switch branches   drill git

Front

How do you switch branches in Git?

Back

Use the command: git checkout [branch-name]

Merge branches   drill git

Front

How do you merge branches in Git?

Back

  1. Switch to the target branch: git checkout [target-branch]
  2. Merge the source branch: git merge [source-branch]

View commit history   drill git

Front

How do you view the commit history in Git?

Back

Use the command: git log For a compact view: git log –oneline

Author: Jason Walsh

j@wal.sh

Last Updated: 2024-10-30 16:43:54