Question : What is Git?
A version control system
A programming language
An operating system
A web browser
Correct Answer : A version control system
Question : How do you create a new Git repository?
`git init`
`git create`
`git new`
`git repo init`
Correct Answer : `git init`
Question : How do you clone an existing Git repository?
`git clone <repository_url>`
`git pull <repository_url>`
`git checkout <repository_url>`
`git fetch <repository_url>`
Correct Answer : `git clone <repository_url>`
Question : How do you stage changes in Git?
`git add .`
`git commit -m 'message'`
`git stage .`
`git push`
Correct Answer : `git add .`
Question : How do you commit changes in Git?
`git commit -m 'message'`
`git add .`
`git push`
`git commit -a -m 'message'`
Correct Answer : `git commit -m 'message'`
Question : How do you check the status of your Git repository?
`git status`
`git info`
`git check`
`git show`
Correct Answer : `git status`
Question : How do you create a new branch in Git?
`git new-branch <branch_name>`
`git create-branch <branch_name>`
`git branch <branch_name>`
`git checkout -b <branch_name>`
Correct Answer : `git checkout -b <branch_name>`
Question : How do you switch to a different branch in Git?
`git switch <branch_name>`
`git checkout <branch_name>`
`git change-branch <branch_name>`
`git move-to <branch_name>`
Correct Answer : `git checkout <branch_name>`
Question : How do you merge branches in Git?
`git merge <branch_name>`
`git branch <branch_name>`
`git merge-branch <branch_name>`
`git combine <branch_name>`
Correct Answer : `git merge <branch_name>`
Question : How do you resolve conflicts in Git?
Manually edit the conflicted files
`git resolve`
`git conflict`
`git fix`
Correct Answer : Manually edit the conflicted files
Question : How do you view the commit history in Git?
`git log`
`git history`
`git show`
`git commits`
Correct Answer : `git log`
Question : How do you discard changes in a file and revert to the last commit version in Git?
`git discard <file>`
`git revert <file>`
`git reset <file>`
`git remove <file>`
Correct Answer : `git reset <file>`
Question : How do you remove a file from a Git repository?
`git remove <file>`
`git delete <file>`
`git rm <file>`
`git erase <file>`
Correct Answer : `git rm <file>`
Question : How do you rename a file in Git?
`git rename <old_name> <new_name>`
`git mv <old_name> <new_name>`
`git move <old_name> <new_name>`
`git rename-file <old_name> <new_name>`
Correct Answer : `git mv <old_name> <new_name>`
Question : How do you view the changes made in a specific commit in Git?
`git changes <commit_id>`
`git show <commit_id>`
`git diff <commit_id>`
`git view <commit_id>`
Correct Answer : `git show <commit_id>`
Question : How do you remove untracked files in Git?
`git remove-untracked`
`git clean`
`git clear`
`git remove --untracked`
Correct Answer : `git clean`
Question : How do you undo the last commit in Git?
`git undo`
`git revert HEAD`
`git reset --hard HEAD`
`git commit --undo`
Correct Answer : `git reset --hard HEAD`
Question : How do you create and apply a Git patch?
`git create-patch` and `git apply-patch`
`git patch-create` and `git patch-apply`
`git diff > patch` and `git apply patch`
`git create-diff` and `git apply-diff`
Correct Answer : `git diff > patch` and `git apply patch`
Question : How do you discard changes in all files and revert to the last commit version in Git?
`git discard-all`
`git reset --hard HEAD`
`git revert-all`
`git remove-all`
Correct Answer : `git reset --hard HEAD`
Question : How do you remove a branch in Git?
`git remove-branch <branch_name>`
`git branch -d <branch_name>`
`git delete <branch_name>`
`git rm <branch_name>`
Correct Answer : `git branch -d <branch_name>`
Question : How do you rename a branch in Git?
`git rename-branch <old_name> <new_name>`
`git mv-branch <old_name> <new_name>`
`git branch -m <old_name> <new_name>`
`git move-branch <old_name> <new_name>`
Correct Answer : `git branch -m <old_name> <new_name>`
Question : How do you view the changes made between two commits in Git?
`git diff <commit1> <commit2>`
`git changes <commit1>..<commit2>`
`git show <commit1>..<commit2>`
`git diff <commit1>..<commit2>`
Correct Answer : `git diff <commit1> <commit2>`
Question : How do you create an empty commit in Git?
`git commit --empty`
`git commit -e`
`git commit -a`
`git commit --allow-empty`
Correct Answer : `git commit --allow-empty`
Question : How do you remove a remote branch in Git?
`git remote remove <branch_name>`
`git remove remote <branch_name>`
`git remote delete <branch_name>`
`git push --delete origin <branch_name>`
Correct Answer : `git push --delete origin <branch_name>`
Question : How do you update your local repository with changes from the remote repository in Git?
`git fetch` followed by `git merge`
`git pull`
`git sync`
`git update`
Correct Answer : `git pull`
Question : How do you view the list of remote repositories in Git?
`git list-remotes`
`git remote show`
`git remote list`
`git remote -v`
Correct Answer : `git remote -v`
Question : How do you push a new branch to a remote repository in Git?
`git push <remote> <branch>`
`git push --branch <branch>`
`git push origin <branch>`
`git push -b <branch>`
Correct Answer : `git push <remote> <branch>`
Question : How do you configure your name and email in Git?
`git set-name <name>` and `git set-email <email>`
`git config user.name <name>` and `git config user.email <email>`
`git name <name>` and `git email <email>`
`git config --name <name>` and `git config --email <email>`
Correct Answer : `git config user.name <name>` and `git config user.email <email>`
Question : How do you create an annotated tag in Git?
`git tag <tag_name>`
`git create-tag <tag_name>`
`git annotate-tag <tag_name>`
`git tag -a <tag_name>`
Correct Answer : `git tag -a <tag_name>`
Question : How do you view the list of tags in Git?
`git list-tags`
`git show-tags`
`git tag`
`git tag list`
Correct Answer : `git tag`
Comments
Post a Comment