Branches, checkout and switch, fast-forward and three-way merges, conflict resolution, tags and detached HEAD.
40 cards · basic cards · AI-written, checked twice. Edit anything.
- What is a branch in Git?
Show answer
A pointer to a specific commit, allowing parallel development.
- What command creates a new branch named 'feature'?
Show answer
git branch feature
- What command lists all local branches?
Show answer
git branch
- What does 'git branch -a' show?
Show answer
All branches, both local and remote.
- What is the default main branch name in modern Git repositories?
Show answer
main
- What command deletes a local branch?
Show answer
git branch -d branch-name
- What command renames the current branch to 'new-name'?
Show answer
git branch -m new-name
- How do you push a new local branch to the remote repository?
Show answer
git push origin branch-name
- What is the key difference between 'git checkout' and 'git switch'?
Show answer
git switch is newer and more explicit; git checkout has dual purposes.
- What does 'git switch -c branch-name' do?
Show answer
Creates a new branch and switches to it in one command.
- What is the modern command to switch to an existing branch?
Show answer
git switch branch-name
- What does 'git checkout -' do?
Show answer
Switches to the previously checked-out branch.
- What is the older way to create and switch to a branch in one command?
Show answer
git checkout -b branch-name
- What is a fast-forward merge?
Show answer
A merge where the target branch pointer moves forward to the source branch commit without creating a merge commit.
- When does a fast-forward merge occur?
Show answer
When the target branch has no new commits since the source branch was created from it.