Do you know that? 66% like freelancing because there is more choice over the project they do next

Contact Email: teammmrem@yahoo.com

<< All Upwork (oDesk) and Elance Tests << Elance test answers << IT & Programming category

Test answers for Git 2016

(69) Last updated: January 23
Elance • IT & Programming
Questions and answers are regularly updated. Answered and not answered tests questions.

This helps getting job: Hundreds of (cover letter examples , interview questions , profile samples ) • Earn on Upwork (oDesk)
Job assistance: jobs popularityfreelance rates

Popular test answers: HTML, .Net, CSS, English, SEO, Photoshop, iOS, Java, Android, Ruby, Python, JavaScript

See all 6 tests answers updated

Find Upwork (oDesk) and Elance test answers on this website:



Collapse | Expand

69 Answered Test Questions:

1. What command creates a git repository in your current directory?

Answers:

• git init

• git prepare

• git begin

• git start

2. What command undoes all changes since the last commit?

Answers:

• git revert

• git reset

• git undo

• git rm

3. What shortcut creates and checks out a branch simultaneously?

Answers:

• git-branch-and-checkout <branchname>

• git checkout -b <branchname>

• git branch --checkout <branchname>

• there is no shortcut: git branch <branchname>; git checkout <branchname> is the fastet way

4. Who invented Git?

Answers:

• Mark Zuckerberg

• Steve Wozniak

• Linus Torvalds

• Steve Jobs

• Bill Gates

5. How would one add Remote Repositories?

Answers:

• git remote add [shortname] [url]

• git remote [shortname] [url]

6. Which file in a git repository specifies intentionally untracked files that git should ignore?

Answers:

• .gitexclude

• .git-ignore

• .gitignore

• .git-exclude

7. What is the main branch of a git repo commonly called?

Answers:

• master

• current

• main

• HEAD

8. How many remote servers can 1 Git repo pull changes from?

Answers:

• 16

• 64

• 128

• 32

• No Limit

9. What file is used inside of a repository, to list files that should be ignored by git?

Answers:

• .gitignore

• .ignore

• .noadd

• .git

10. What does adding the -m option to git commit do?

Answers:

• Commits without message

• Halts the commit if the current branch is the master branch

• Commits to master regardless of the current branch

• Uses the given message as the commit message

11. What is the command for displaying the version of git being used?

Answers:

• git --help

• git --bare

• git --v

• git --version

12. Is possible to have a global .gitignore file?

Answers:

• No

• Yes

13. What is the command for viewing a list of recent commits?

Answers:

• git show

• git list

• git log

• git merge

• git bisect

14. How do you determine the current state of the project?

Answers:

• $ git status

• (all of these options)

• $ git stat

• git stat

15. What is the command for switching branches?

Answers:

• git fetch <branch name>

• git switch <branch name>

• git pull <branch name>

• git checkout <branch name>

• git clone <branch name>

16. What is the correct way to add multiple files to the staging area?

Answers:

• git include file1.txt file2.txt file3.txt

• git add file1.txt fil2.txt file3.txt

• git add file1.txt, file2.txt, file3.txt

• git include file1.txt, file2.txt, file3.txt

17. How do you add all files in current directory to git repository?

Answers:

• git add .

• git add ./

• git add all

• git add

18. The following command does what; $ git commit -am "Commit"

Answers:

• Creates a git alias command of Commit to make commits

• Commits only the staged files with message "Commit"

• Adds all tracked changes and commits them with the message "Commit"

19. Which command shows you the version of your git installation.

Answers:

• git -v

• which git

• git --info

• git --version

• (none of these)

20. How do you retrieve changes from a remote repo?

Answers:

• git get origin master

• git pull origin master

• git pull master

• git pull master origin

• git remote master

21. You want to revert 'notes.txt' to the version in the most recent commit.

Answers:

• git checkout -- /path/to/notes.txt

• git drop HEAD /path/to/notes.txt

• git dropback -- /path/to/notes.txt

22. To limit the "git diff" comparison to the file foo.txt, use:

Answers:

• git diff foo.txt

• all are correct

• git diff foo

• git diff HEAD..foo.txt

23. Which command deletes the branch named "stinky" regardless of merge status ?

Answers:

• git branch -D stinky

• git branch --remove stinky

• git rm stinky

• git delete stinky

24. How do you stage all changes?

Answers:

• git stage .

• git stage all

• git add all

• git add .

25. How can I get the commit ID?

Answers:

• git --version

• git info

• git id

• git ID

• git log

26. Which command will restore the current branch and working copy to the exact state it was at before the most recent commit?

Answers:

• git revert --no-edit HEAD

• git reset --hard HEAD^

• git checkout HEAD@{1}

• git commit --revert

27. A staged file is

Answers:

• A file added to the index

• A file that has been modified

• A committed file

• It does not exist

• An ignored file

28. How do you undo all changes since your last commit?

Answers:

• git undo --hard

• git reset --hard

• git reset

• git reset <branch>

• git undo <branch>

29. What option suppresses output for git rm?

Answers:

• --quiet

• --verbose=false

• --summary

• --short

30. When pushing to a remote server, what is the only type of merge that is accepted by default?

Answers:

• All are accepted

• Recursive

• Round-Robin

• Fast-Forward

31. What is the default text editor used by git?

Answers:

• a browser

• emacs

• vim

• system default

• notepad

32. How to display a list of configuration parameters?

Answers:

• git config

• No way of doing that, except by editing the config file.

• git configuration -l

• git configuration

• git config -l

33. Which command will show what revision and author last modified each line of a file?

Answers:

• git bisect

• git revision

• git review

• git examine

• git blame

34. How do you add another git repository as a directory of your repository

Answers:

• git remote add <repository> <local directory>

• git submodule add <repository> <local directory>

• git module <repository> <local directory>

• git add <local directory> <repository>

35. What git feature allows you to embed separate repos?

Answers:

• submodules

• remotes

• subrepos

36. Which one of the following commands lists REMOTE branches only?

Answers:

• git branch -r

• git branch --all

• git branch -a

• git branch --remote r

37. `git rebase <upstream>` will:

Answers:

• Replay the changes made in <upstream> on top of the changes made in the current branch (as if the changes in <upstream> had been done after the changes in the current branch)

• Re-pack GITs object store for <upstream>

• Replay the changes made in the current branch on top of the changes made in <upstream> (as if the changes in the current branch had been done after the changes in <upstream>)

• Push the changes in the current repository into a named branch in <upstream>

38. How do you add only certain parts of a file to the index?

Answers:

• git add -p

• git add -s

• git add patch

• git add partial

39. What's the purpose of 'git bisect' ?

Answers:

• Cancel the previous commit (if not pushed)

• Sign the last commit (with a gpg key)

• Find your last commit

• Find the commit which introduced a bug

• Reset a file to the last commit

40. Which command removes file foo.txt from the index but not from the working directory?

Answers:

• git reset foo.txt; git commit

• git reset HEAD -- foo.txt; git commit

• git rm --cached foo.txt

• git rm foo.txt; git commit

41. What is the command to show the un-merged branches (local and/or remote) within the current branch?

Answers:

• All of these

• git branch -a --no-merged

• git branch --no-merged

42. What is the "git status" option used to output the shortened project status?

Answers:

• -b

• -s

• --brief

• --verbose=false

43. What is the option to print a text-base graphic of the commit history when doing 'git log'?

Answers:

• -g

• --graph

• --show-graph

• -G

44. Which command will move the changes from the last commit into in the stage area?

Answers:

• git reset --hard

• git reset HEAD .

• git reset --soft HEAD^

• git checkout .

45. Which of these commands alters existing commits?

Answers:

• reset

• rewind

• rebase

• revert

46. Which command creates a new commit that undoes the changes in the most recent commit?

Answers:

• git checkout -1

• git revert

• git revert HEAD

• git checkout HEAD

• git checkout

47. What is the git diff option to show the diffs of unstaged changes?

Answers:

• HEAD

• --cached

• no option necessary

• --unstaged

48. git mv is equivalent to what sequence of commands?

Answers:

• mv old new; git update new

• git rm --cached old; mv old new; git add new

• git rm old; mv old new; git add new;

• mv old new; git add new

49. What does the git merge option -s abbreviate?

Answers:

• --strategy

• --short

• --summary

• --speedy

50. What is the common short-hand for deleting a branch in a remote repository?

Answers:

• git branch -d -r <repository> <branch>

• git reset <repository> <branch>

• git rm <repository>/<branch>

• git push <repository> :<branch>

• git branch -D <repository>/<branch>

51. How do you get all submodules to clone after you have cloned a repository?

Answers:

• git init submodule --recursive

• git submodule update --init --recursive

• git clone submodule --recursive

• git update submodules

• git submodule clone --all

52. What is the relationship between the --short and --dry-run options for git commit?

Answers:

• --dry-run works only if --short is also specified

• --short and --dry-run cannot be used together

• --short works only if --dry-run is also specified

• using --short implies --dry-run

53. You stage two files, f1 and f2.  Which command unstages only f1?

Answers:

• git reset f1

• git reset HEAD f1

• git reset HEAD -- f1

• git reset -- f1

54. How do you set an existing local branch to track a remote branch?

Answers:

• git pull localbranch remotebranch

• git branch --set-upstream localbranch remotebranch

• git checkout -b localbranch remotebranch

• git branch --track localbranch remotebranch

55. Which command will effectively preview a merge without making any changes?

Answers:

• git diff HEAD..<remote>/<branch>

• git diff ...<remote>/<branch>

• git merge --dry-run <remote> <branch>

56. The command "git diff", without any additional arguments, shows...

Answers:

• changes tracked by Git in the working directory that are not yet staged for the next commit.

• differences between the index (what is currently staged) and your last commit; what you would be committing if you run "git commit" without the "-a" option.

• changes in the working directory since your last commit; what you would be committing if you run "git commit -a".

• differences between the working directory and the last commit to the master branch.

• differences between the working directory and the tip of the current branch.

57. Which git rebase mode allows you to combine commits by 'squashing'?

Answers:

• Fast Forward

• Squash

• Verbose

• Interactive

58. What is the difference between the -c and -C options for git commit?

Answers:

• -c invokes the editor while -C does not

• -c renews the author and timestamp while -C does not

• -C forces the commit while -c halts on errors

• -C deletes the copied commit object while -c does not

59. What is the git diff option used to output the shortened diffs for a file foo.txt ?

Answers:

• git diff --brief foo.txt

• git diff --stat foo.txt

• git diff --summary foo.txt

• git diff --verbose=false foo.txt

60. Normally "HEAD" stores the name of a branch, and it is said to be detached when:

Answers:

• it refers to anything but the most recent commit.

• it refers to an arbitrary commit that is not the tip of a branch.

• it is not on any branch.

• it refers to a commit not on the master branch.

• it refers to a commit not on the current branch.

61. What does the git commit option -s abbreviate?

Answers:

• --status

• --speedy

• --signoff

• --short

62. What is the abbreviation for the --dry-run option of git add?

Answers:

• -y

• -n

• -d

• -r

63. Which command allows you to get the blob of some file whether it is in a repository or not?

Answers:

• git encode

• git blob

• git object

• git hash-object

• git hash

64. Which of these two statements makes git use the file from the conflicting commit you are merging from?

Answers:

• git merge --theirs index.html

• git checkout --theirs index.html

65. What git commit option is equivalent to using both the -F and -e options?

Answers:

• -z

• -t

• -n

• -s

66. How is it possible to record a merge from branch "oldBranch" into master without modifying master content?

Answers:

• git merge --strategy=ours oldBranch

• git merge --record oldBranch

• git merge oldBranch & git reset --hard

• it is not possible, git is not SVN.

67. Which command obtains the common parent of two commits?

Answers:

• git merge-base <commit1> <commit2>

• git common-parent <commit1> <commit2>

• git common-base <commit1> <commit2>

• git fetch-base <commit1> <commit2>

68. What does adding the -a option to git commit do?

Answers:

• adds all changes from known files, removes all files in the index but not in the working tree, and performs a commit

• adds all changes from all files, known and unknown, removes all files in the index but not in the working tree, and performs a commit

• adds all changes from all files, known and unknown, and performs a commit

• adds all changes from known files and performs a commit

69. What is the git diff option to show the diffs of both staged and unstaged changes?

Answers:

• HEAD

• --cached

• --both

• no option necessary