Skip to content

Module 2 challenge: Merging Branches in Git :Introduction to Git and GitHub (Google IT Automation with Python Professional Certificate) Answers 2025

1. Command to change a commit to a previous state
❌ git add
❌ git merge
✔️ git revert
❌ git checkout

2. Command to view commit history with author info
❌ git branch
❌ git diff
❌ git status
✔️ git log

3. Command to create a patch file for changes
❌ git checkout > changes.patch
❌ git commit > changes.patch
❌ git patch > changes.patch
✔️ git diff > changes.patch

4. Main purpose of a remote repository
❌ To store individual team member’s versions of the project
❌ To maintain backup copies of the project
✔️ To function as a central repository where all team members can push and pull changes
❌ To keep the final version after all changes

5. True statements about merging in Git
✔️ Conflicts may occur during merging
✔️ Merged changes can be undone using git revert
❌ Merging always creates a new commit
❌ Merging cannot be performed on detached HEAD

6. Command to create a new branch
❌ git commit
✔️ git branch
❌ git merge
❌ git checkout

7. Purpose of creating and using branches
❌ To create a backup of the repository
❌ To clone the repository
❌ To permanently delete files
✔️ To isolate and work on new features, fixes, or experiments separately from the main codebase

8. Meaning of a ‘merge conflict’
❌ There is a syntax error in your code
❌ The branch you are trying to merge does not exist
✔️ Git can’t automatically merge the changes and needs your help to resolve the conflict
❌ You have forgotten to pull the latest changes before merging

9. Purpose of branching in Git
✔️ To isolate changes for a specific feature or issue
❌ To create a copy of a repository
❌ To merge two or more commits
❌ To delete a repository

10. Consideration when deciding to create a new branch
❌ The number of collaborators
❌ The number of commits
✔️ Whether the changes are significant or experimental
❌ The size of the repository


📌 Summary Table

Q# Correct Answer(s)
1 git revert ✔️
2 git log ✔️
3 git diff > changes.patch ✔️
4 Central repository for push/pull ✔️
5 Conflicts may occur ✔️, git revert can undo ✔️
6 git branch ✔️
7 Isolate features/fixes/experiments ✔️
8 Git can’t automatically merge, needs manual resolution ✔️
9 Isolate changes for feature/issue ✔️
10 Significant/experimental changes ✔️