1) The “git reset –soft ” command:

a) Adds a commit which undoes all file changes made in <commit-id>
b) Add a commit which undoes all file changes since <commit-id>
c) Removes all commits and file changes since <commit-id>
d) Removes all commits since <commit-id> but keeps the changes in files

Answer(s) : 
d) Removes all commits since commit-id but keeps the changes in files

[quads id=1]

2) The “git fetch” command:

a) Pulls updates from remote for current branch but does not apply them on local branch
b) Pulls updates from remote for current branch and applies them on local branch

c) Pulls updates from remote for all branches but does not apply them on local branches
d) Pulls updates from remote for all branches and applies them on all local branches

Answer(s) : 
c) Pulls updates from remote for all branches but does not apply them on local branches

3) Which of the following is enough to recreate an existing git project on your local (along with the version info):

a) All files comprising the project which were committed to git
b) The .git folder present in the project
c) Link to a public gitlab repository hosting the project
d) None of the above

Answer(s) : 
b) The .git folder present in the project
c) Link to a public gitlab repository hosting the project

[quads id=1]

4) The “git stash” command:

a) Is used to delete uncommitted changes in files
b) Is used to save uncommitted changes in files for later

c) Is used to recover deleted commits from a branch
d) Is used to recover deleted files from a project

Answer(s) : 
b) Is used to save uncommitted changes in files for later

5) Which flag for the “git commit” command is used to make a change to a commit just made in git:

a) –modify
b) –amend
c) –change
d) –update

Answer(s) : 
b) --amend

[quads id=1]

6) Which of the following are popular services which help host remote git repositories:

a) Github
b) Bitlab
c) Gitbucket
d) Bitbucket

Answer(s) : 
a) Github
d) Bitbucket

7) Adding the line “src/*.txt” to the .gitignore file of a git project ensures:

a) All .txt files will now not be tracked by git
b) All .txt files in src folder will now not be tracked by git
c) All .txt files in src folder and its subdirectories will now not be tracked by git
d) All .txt files in src folder which are not already being tracked will not be tracked by git

Answer(s) : 
d) All .txt files in src folder which are not already being tracked will not be tracked by git 

[quads id=1]

8) Which of the following git commands is used to output the list of commits made on current branch:

a) Git log
b) Git commit list
c) Git status
d) Git ls-tree

Answer(s) : 
a) Git log

9) Which of the following commands can cause a file to be in conflict state which will have to resolved:

a) Git pull
b) Git push
c) Git merge <branch>
d) Git checkout <branch>

Answer(s) : 
a) Git pull
c) Git merge branch

[quads id=1]

10) Which of the following commands is used to delete a remote branch:

a) Git branch -D <branch>
b) Git branch -d <branch>
c) Git push origin :<branch>
d) Git branch -D <branch> && git push origin <branch>

Answer(s) : 
c) Git push origin :branch