Git u0026 Version Control Collaboration Quiz Quiz

  1. Committing Changes

    Which command is used to save your staged changes to the local Git repository?

    1. git commit
    2. git push
    3. git save
    4. git stage
    5. git commmit
  2. Resolving Merge Conflicts

    Suppose you try to merge two branches, but Git reports a ‘merge conflict’ in main.py. What should you do to resolve this?

    1. Edit main.py to correct the conflicting parts, then add and commit the changes
    2. Revert the merge with git revert
    3. Run git force to override the conflict
    4. Delete main.py and pull again
    5. Ignore the message and continue with git push
  3. Cloning a Repository

    What is the correct command to create a local copy of a remote Git repository?

    1. git clone
    2. git copy
    3. git fetch
    4. git synk
    5. git init-clone
  4. Viewing History

    Which Git command allows you to view the history of commits in your repository?

    1. git log
    2. git hist
    3. git track
    4. git historys
    5. git show-log
  5. Branching

    If you want to work on a new feature without affecting the main branch, which Git command would you use to create a new branch called 'feature-x'?

    1. git branch feature-x
    2. git creat feature-x
    3. git checkout feature-x
    4. git clone feature-x
    5. git make-branch feature-x
  6. Staging Files

    Which command will add changes in all files to the staging area in Git?

    1. git add .
    2. git stageall
    3. git commit --all
    4. git status-add
    5. git save .
  7. Collaboration

    You and a teammate both edited the same file. What happens if you both 'push' your changes at the same time?

    1. The first push will succeed, while the second receives a rejection due to conflicts
    2. Both pushes will overwrite each other
    3. Both pushes will merge automatically without error
    4. Both pushes will be accepted with duplicate files
    5. Git will delete the file to resolve the conflict
  8. Remote Repositories

    Which command updates your local repository with changes from the remote, without merging them into your current branch?

    1. git fetch
    2. git pull
    3. git get
    4. git update-remote
    5. git syncronize
  9. Undoing Changes

    You have staged changes but not yet committed them. Which command will remove all staged changes and return to the last committed state?

    1. git reset --hard
    2. git checkout .
    3. git undo-last
    4. git go-back
    5. git delete-stage
  10. Ignoring Files

    How do you tell Git to ignore specific files, such as `temp.log`, in all future commits?

    1. Add temp.log to a .gitignore file
    2. Set file as hidden in the OS
    3. Use git remove temp.log
    4. Create a .notrack file and list temp.log
    5. Add temp.log to .gitexclude