Committing Changes
Which command is used to save your staged changes to the local Git repository?
- git commit
- git push
- git save
- git stage
- git commmit
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?
- Edit main.py to correct the conflicting parts, then add and commit the changes
- Revert the merge with git revert
- Run git force to override the conflict
- Delete main.py and pull again
- Ignore the message and continue with git push
Cloning a Repository
What is the correct command to create a local copy of a remote Git repository?
- git clone
- git copy
- git fetch
- git synk
- git init-clone
Viewing History
Which Git command allows you to view the history of commits in your repository?
- git log
- git hist
- git track
- git historys
- git show-log
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'?
- git branch feature-x
- git creat feature-x
- git checkout feature-x
- git clone feature-x
- git make-branch feature-x
Staging Files
Which command will add changes in all files to the staging area in Git?
- git add .
- git stageall
- git commit --all
- git status-add
- git save .
Collaboration
You and a teammate both edited the same file. What happens if you both 'push' your changes at the same time?
- The first push will succeed, while the second receives a rejection due to conflicts
- Both pushes will overwrite each other
- Both pushes will merge automatically without error
- Both pushes will be accepted with duplicate files
- Git will delete the file to resolve the conflict
Remote Repositories
Which command updates your local repository with changes from the remote, without merging them into your current branch?
- git fetch
- git pull
- git get
- git update-remote
- git syncronize
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?
- git reset --hard
- git checkout .
- git undo-last
- git go-back
- git delete-stage
Ignoring Files
How do you tell Git to ignore specific files, such as `temp.log`, in all future commits?
- Add temp.log to a .gitignore file
- Set file as hidden in the OS
- Use git remove temp.log
- Create a .notrack file and list temp.log
- Add temp.log to .gitexclude