Recall & Review
beginner
How do you delete a local Git branch named
feature1?Use the command
git branch -d feature1 to delete the local branch feature1. This only works if the branch is fully merged.Click to reveal answer
intermediate
What command force deletes a local Git branch even if it is not merged?
Use
git branch -D branch_name to force delete a local branch regardless of merge status.Click to reveal answer
beginner
How do you delete a remote Git branch named
feature1?Use
git push origin --delete feature1 to delete the remote branch feature1 from the remote repository.Click to reveal answer
beginner
What happens if you try to delete the branch you are currently on?
Git will not allow deleting the branch you are currently on. You must switch to a different branch first.
Click to reveal answer
intermediate
Why should you be careful when force deleting branches?
Force deleting branches can cause loss of unmerged work. Always double-check before using
-D to avoid losing important changes.Click to reveal answer
Which command deletes a local Git branch only if it is fully merged?
✗ Incorrect
The command 'git branch -d branch_name' deletes a local branch only if it is fully merged.
How do you delete a remote branch named
feature1?✗ Incorrect
Use 'git push origin --delete feature1' to delete a remote branch.
What does the
-D option do when deleting a branch?✗ Incorrect
The '-D' option force deletes a local branch even if it has unmerged changes.
What must you do before deleting the branch you are currently on?
✗ Incorrect
You must switch to a different branch before deleting the current branch.
Why is it risky to force delete a branch?
✗ Incorrect
Force deleting can cause loss of unmerged work, so use it carefully.
Explain how to safely delete a local Git branch and what precautions to take.
Think about merge status and current branch.
You got /4 concepts.
Describe the steps to delete a remote Git branch and why it might be necessary.
Consider remote repository management.
You got /3 concepts.