git_fundamentals_deck Flashcards

(60 cards)

1
Q

What is Git?

A

A distributed version control system - every developer has a full copy of the repo on their machine - GitHub/GitLab is the remote host for the source of truth copy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a repository (repo)?

A

A project folder tracked by Git - contains all files - folders - and the full history of every change ever made

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does distributed mean in Git?

A

Every developer has the complete repo and history locally - not dependent on a central server to work

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the three states of a file in Git?

A
  1. Working Directory (your edits) 2. Staging Area (marked ready with git add) 3. Repository (committed snapshots - permanent history)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the working directory?

A

Your local files on disk - what you’re actively editing - Git tracks changes against the last commit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the staging area?

A

A holding zone for changes you’ve marked as ready to commit - you choose what goes in with git add

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does git init do?

A

Initializes a new Git repo in the current directory - creates a hidden .git folder that tracks everything

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does git clone do?

A

Downloads a full copy of a remote repo to your local machine - includes all history and branches

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does git status do?

A

Shows the current state of your working directory and staging area - which files are modified - staged - or untracked

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does git add do?

A

Moves file changes from working directory to the staging area - git add . stages everything - git add <file> stages one file</file>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does git commit do?

A

Takes a snapshot of everything in the staging area and saves it to the repo history with a message

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does git push do?

A

Sends your local commits to the remote repo (GitHub) - git push origin <branch-name></branch-name>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does git pull do?

A

Downloads and merges the latest changes from the remote repo into your local branch

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does git log –oneline do?

A

Shows the commit history in a compact format - one line per commit with hash and message

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is .gitignore?

A

A file that tells Git which files and folders to never track - like node_modules - __pycache__ - .env - *.zip

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Why do you gitignore node_modules?

A

It contains thousands of dependency files that can be regenerated with npm install - bloats the repo and slows everything down

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Why do you gitignore .env files?

A

They contain environment secrets like API keys - database URLs - credentials - never commit secrets to a repo

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is a commit hash?

A

A unique SHA identifier for each commit - like a fingerprint - example: a1b2c3d - used to reference specific commits

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is a remote?

A

A version of your repo hosted somewhere else - usually GitHub - the default remote is called origin

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What does origin mean in Git?

A

The default name for your remote repository - when you clone a repo the source automatically gets named origin

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is the difference between git add and git commit?

A

git add stages changes (marks them ready) - git commit saves the staged changes as a permanent snapshot

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is an untracked file?

A

A new file Git has never seen before - shows up in git status until you git add it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What is a modified file?

A

A tracked file that has changes since the last commit - needs to be staged with git add before committing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What is the basic Git workflow for a single change?

A

1.Edit file
2. git add <file>
3. git commit -m "message"
4. git push origin <branch-name></branch-name></file>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What is a good commit message format?
type: short description - examples: fix: add missing greeting prompt - feat: add claim status Lex bot - docs: update architecture diagram
26
What are common commit message types?
fix (bug fix) - feat (new feature) - docs (documentation) - refactor (code restructure) - chore (maintenance) - hotfix (production emergency fix)
27
What does git diff do?
Shows the exact line-by-line changes in your working directory that haven't been staged yet
28
What does git diff --staged do?
Shows the exact line-by-line changes that have been staged but not yet committed
29
What happens if you commit without staging?
Nothing gets committed - Git only commits what's in the staging area - you must git add first
30
How would you clone the Likewize Connect repo on day 1?
git clone then cd into the directory - you'd have the full repo with all Lambda code - contact flows - DynamoDB configs locally
31
What is a branch?
An independent line of development - a pointer to a specific commit - lets you work on features without affecting the main codebase
32
What does git checkout -b do?
Creates a new branch and switches to it in one command - shortcut for git branch + git checkout
33
What is the main (or master) branch?
The production branch - represents the deployed stable code - you never commit directly to main
34
What is a dev branch?
The integration branch where feature branches merge into first - used for development testing before staging/prod
35
What is a feature branch?
A branch created for one specific piece of work - named like feature/claim-status-lex-bot - merges back to dev when done
36
What is a hotfix branch?
A branch created off main/prod for emergency production fixes - bypasses the normal dev → staging flow - named like hotfix/uk-porting-disconnect
37
What is the Likewize branching model?
main (prod) ← staging ← dev ← feature branches - hotfix branches go directly off main for emergencies
38
What does git checkout do?
Switches between branches - git checkout dev moves you to the dev branch - git checkout main moves you to main
39
What does git branch do?
Lists all local branches - the current branch shows with an asterisk (*) - git branch -a shows remote branches too
40
What does git merge do?
Combines changes from one branch into your current branch - example: on dev you run git merge feature/my-feature
41
What is a merge conflict?
When two branches changed the same lines of the same file - Git can't auto-merge and asks you to manually resolve the conflict
42
What does a merge conflict look like in a file?
<<<<<<< HEAD (your changes) ======= (divider) >>>>>>> branch-name (incoming changes) - you delete the markers and keep what's correct
43
How do you resolve a merge conflict?
1. Open the conflicted file 2. Remove the conflict markers 3. Keep the correct code 4. git add the file 5. git commit
44
What is a Pull Request (PR)?
A request on GitHub to merge one branch into another - includes a description - allows code review and discussion before merging
45
What goes in a good PR description?
What changed - why it changed - how to test it - any risks or notes for reviewers
46
What is a code review?
Another developer reads your PR - checks for bugs - style - logic errors - and either approves or requests changes before merge
47
What is the full dev workflow at Likewize?
1. Create feature branch off dev 2. Write code and commit 3. Push to GitHub 4. Create PR to dev 5. Code review 6. Merge to dev 7. Merge dev to staging 8. Test 9. Merge staging to main 10. Deploy
48
What is a hotfix workflow?
1. Branch off main 2. Fix the issue 3. Push and create PR to main 4. Fast-track review 5. Merge to main and deploy 6. Back-merge fix into dev
49
Why do you back-merge a hotfix into dev?
So the fix exists in all environments - otherwise the next dev → staging → main merge could overwrite or miss the hotfix
50
What does git stash do?
Temporarily saves uncommitted changes so you can switch branches cleanly - git stash pop brings them back
51
When would you use git stash at Likewize?
You're working on a feature branch but a production fire hits - stash your work - switch to main - create hotfix branch - fix it - then come back
52
What does git fetch do?
Downloads updates from the remote but doesn't merge them - lets you see what's changed before pulling
53
What is the difference between git fetch and git pull?
git fetch downloads without merging - git pull does fetch + merge in one step - fetch is safer when you want to review first
54
What does HEAD mean in Git?
A pointer to the current commit you're on - usually the tip of whatever branch you have checked out
55
What does git reset --soft HEAD~1 do?
Undoes the last commit but keeps changes staged - useful if you committed too early or with the wrong message
56
What does git reset --hard HEAD~1 do?
Undoes the last commit AND throws away the changes completely - destructive - use carefully
57
What does git revert do?
Creates a new commit that undoes a previous commit - safer than reset because it doesn't rewrite history
58
When would you use revert vs reset?
Revert on shared/pushed branches (safe - preserves history) - Reset on local unpushed work (rewrites history)
59
What does git log --graph --oneline do?
Shows commit history with a visual branch/merge graph - helpful for understanding how branches were merged
60
What does git remote -v do?
Shows the URLs of your configured remotes - useful to verify you're pushing/pulling from the right place