Branch Integration Methods
In Git, what is a key difference between using 'rebase' and 'merge' when integrating changes from one branch to another?
- A. Rebase moves the feature branch and rewrites history, while merge creates a new commit and preserves all history.
- B. Rebase deletes all previous commits, merge does not.
- C. Merge can only be used on empty repositories, but rebase cannot.
- D. Rebase always results in a conflict, while merge never does.
- E. There is no difference between the two.
Resolving Merge Conflicts
If you encounter a merge conflict while using Git, which step should you perform first?
- A. Open the conflicted file and edit it to resolve the issues.
- B. Immediately delete the repository.
- C. Run the git reset --hard command.
- D. Switch to another branch without saving changes.
- E. Ignore the conflict and proceed.
Undoing a Public Commit
If you need to undo a commit that has already been pushed and made public, which Git command is recommended for safely creating a new commit to reverse those changes?
- A. git revert u003Ccommit idu003E
- B. git delete u003Ccommit idu003E
- C. git erase u003Ccommit idu003E
- D. git update u003Ccommit idu003E
- E. git abort u003Ccommit idu003E
Reset and Abort Commands
What does the 'git merge --abort' command accomplish?
- A. Stops the current merge process and restores the state to before merging began.
- B. Deletes the entire repository.
- C. Pushes commits to the remote repository.
- D. Renames the current branch.
- E. Lists all previous commits.
Finding Changed Files
To list all files changed in a specific Git commit, which command would you use?
- A. git diff-tree -r {commit hash}
- B. git files-change {commit hash}
- C. git list-files {commit hash}
- D. git show-diff {commit hash}
- E. git commit-log {commit hash}
Fixing a Broken Commit
Which Git command is commonly used to amend or fix the most recent commit?
- A. git commit --amend
- B. git fix --latest
- C. git repair-commit
- D. git correct-last
- E. git commit --update
Dropping Stash Items
If you wish to permanently remove a saved stash entry in Git, which command would you use?
- A. git stash drop
- B. git stash save
- C. git stash pick
- D. git stash removeit
- E. git stash recall
Using Cherry-Pick
Suppose you accidentally committed a change to the wrong branch. Which Git command can you use to apply that specific commit to the correct branch?
- A. git cherry-pick
- B. git apple-pick
- C. git pick-branch
- D. git branch-pick
- E. git change-branch
Pull vs Fetch
What is the main difference between 'git pull' and 'git fetch'?
- A. Git pull fetches and merges commits, while git fetch only downloads commits and leaves merging to the user.
- B. Git fetch deletes branches; git pull does not.
- C. Git pull works only with tags, git fetch does not.
- D. There is no difference; they are identical.
- E. Git pull does not create merge commits, git fetch always does.
Understanding Origin
In Git terminology, what does 'origin' usually refer to?
- A. The default name for the remote repository that a project was originally cloned from.
- B. The name of your main development branch.
- C. A file that stores commit history.
- D. The starting point of a Git commit log.
- E. Any backup copy of your repository.