# Master Version Control with Git Flashcards

Table of Contents

1. Git Flashcards

1.1. What is Git?   drill git

1.1.1. Front

What is Git?

1.1.2. Back

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

1.2. Initialize a new Git repository   drill git

1.2.1. Front

How do you initialize a new Git repository?

1.2.2. Back

Use the command: git init

1.3. Clone a repository   drill git

1.3.1. Front

How do you clone a Git repository?

1.3.2. Back

Use the command: git clone [repository URL]

1.4. Check status of working directory   drill git

1.4.1. Front

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

1.4.2. Back

Use the command: git status

1.5. Stage changes   drill git

1.5.1. Front

How do you stage changes in Git?

1.5.2. Back

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

1.6. Commit changes   drill git

1.6.1. Front

How do you commit changes in Git?

1.6.2. Back

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

1.7. Push changes to remote repository   drill git

1.7.1. Front

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

1.7.2. Back

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

1.8. Pull changes from remote repository   drill git

1.8.1. Front

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

1.8.2. Back

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

1.9. Create a new branch   drill git

1.9.1. Front

How do you create a new branch in Git?

1.9.2. Back

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

1.10. Switch branches   drill git

1.10.1. Front

How do you switch branches in Git?

1.10.2. Back

Use the command: git checkout [branch-name]

1.11. Merge branches   drill git

1.11.1. Front

How do you merge branches in Git?

1.11.2. Back

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

1.12. View commit history   drill git

1.12.1. Front

How do you view the commit history in Git?

1.12.2. Back

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