Elance Git Test Answers 2015



What command creates a git repository in your current directory?
git start
git prepare
git init
git begin


How to display a list of configuration parameters?
git config -l
git configuration -l
No way of doing that, except by editing the config file.
git configuration
git config


Which command removes file foo.txt from the index but not from the working directory?
git rm --cached foo.txt
git reset foo.txt; git commit
git rm foo.txt; git commit
git reset HEAD -- foo.txt; git commit


git mv is equivalent to what sequence of commands?
mv old new; git add new
git rm old; mv old new; git add new;
git rm --cached old; mv old new; git add new
mv old new; git update new


`git rebase <upstream>` will:
Push the changes in the current repository into a named branch in <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>)
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>


What is the option to print a text-base graphic of the commit history when doing 'git log'?
--show-graph
--graph
-g
-G


Which command will move the changes from the last commit into in the stage area?
git checkout .
git reset --soft HEAD^
git reset --hard
git reset HEAD .


What git feature allows you to embed separate repos?
remotes
submodules
subrepos


What option suppresses output for git rm?
--verbose=false
--short
--quiet
--summary


Which command will show what revision and author last modified each line of a file?
git blame
git review
git revision
git bisect
git examine


What's the purpose of 'git bisect' ?
Sign the last commit (with a gpg key)
Reset a file to the last commit
Find the commit which introduced a bug
Find your last commit
Cancel the previous commit (if not pushed)


True or False? Is Git a centralized version control system.
True
False


What command undoes all changes since the last commit?
git revert
git rm
git reset
git undo


A staged file is
A committed file
A file that has been modified
An ignored file
A file added to the index
It does not exist


Which one of the following commands lists REMOTE branches only?
git branch --all
git branch -a
git branch --remote r
git branch -r


How can I get the commit ID?
git --version
git id
git info
git ID
git log


To limit the "git diff" comparison to the file foo.txt, use:
git diff HEAD..foo.txt
git diff foo
all are correct
git diff foo.txt


Which command will restore the current branch and working copy to the exact state it was at before the most recent commit?
git revert --no-edit HEAD
git commit --revert
git reset --hard HEAD^
git checkout HEAD@{1}


What shortcut creates and checks out a branch simultaneously?
there is no shortcut: git branch <branchname>; git checkout <branchname> is the fastet way
git checkout -b <branchname>
git branch --checkout <branchname>
git-branch-and-checkout <branchname>


How do you retrieve changes from a remote repo?
git pull master
git pull origin master
git get origin master
git pull master origin
git remote master


What is the correct way to add multiple files to the staging area?
git include file1.txt, file2.txt, file3.txt
git include file1.txt file2.txt file3.txt
git add file1.txt fil2.txt file3.txt
git add file1.txt, file2.txt, file3.txt


The following command does what; $ git commit -am "Commit"
Adds all tracked changes and commits them with the message "Commit"
Commits only the staged files with message "Commit"
Creates a git alias command of Commit to make commits


Which command shows you the version of your git installation.
(none of these)
git --info
git -v
git --version
which git


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


What is the command for switching branches?
git checkout <branch name>
git fetch <branch name>
git pull <branch name>
git clone <branch name>
git switch <branch name>


Who invented Git?
Linus Torvalds
Bill Gates
Steve Wozniak
Mark Zuckerberg
Steve Jobs


How do you determine the current state of the project?
git stat
$ git status
(all of these options)
$ git stat


Which file in a git repository specifies intentionally untracked files that git should ignore?
.gitignore
.git-exclude
.gitexclude
.git-ignore


Is possible to have a global .gitignore file?
Yes
No


Which command deletes the branch named "stinky" regardless of merge status ?
git branch --remove stinky
git branch -D stinky
git rm stinky
git delete stinky


What is the command for viewing a list of recent commits?
git log
git list
git bisect
git merge
git show


You want to revert 'notes.txt' to the version in the most recent commit.
git checkout -- /path/to/notes.txt
git drop HEAD /path/to/notes.txt
git dropback -- /path/to/notes.txt


How do you stage all changes?
git add .
git stage all
git stage .
git add all


How do you undo all changes since your last commit?
git reset
git reset <branch>
git reset --hard
git undo --hard
git undo <branch>


What does adding the -m option to git commit do?
Commits without message
Uses the given message as the commit message
Commits to master regardless of the current branch
Halts the commit if the current branch is the master branch


What is the command for displaying the version of git being used?
git --bare
git --v
git --version
git --help


How many remote servers can 1 Git repo pull changes from?
16
No Limit
128
32
64


How would one add Remote Repositories?
git remote add [shortname] [url]
git remote [shortname] [url]


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


What is the main branch of a git repo commonly called?
HEAD
current
main
master


Using which command you can apply a certain commit to the current branch, using the commit's SHA1?
patch
rebase
pull
cherry-pick
commit


How do you add another git repository as a directory of your repository
git remote add <repository> <local directory>
git module <repository> <local directory>
git submodule add <repository> <local directory>
git add <local directory> <repository>


How do you add only certain parts of a file to the index?
git add partial
git add -s
git add patch
git add -p


Which is the command to remove everything from the stash?
git stash remove
git stash clear
git stash drop
git stash prune
git stash reset


When pushing to a remote server, what is the only type of merge that is accepted by default?
Recursive
Fast-Forward
Round-Robin
All are accepted


What is the default text editor used by git?
emacs
system default
vim
a browser
notepad


What is the "git status" option used to output the shortened project status?
--verbose=false
--brief
-s
-b


What is the command to show the un-merged branches (local and/or remote) within the current branch?
git branch --no-merged
All of these
git branch -a --no-merged


Which of these commands alters existing commits?
revert
rebase
rewind
reset


Which command creates a new commit that undoes the changes in the most recent commit?
git checkout HEAD
git checkout
git revert
git revert HEAD
git checkout -1


What is the git diff option to show the diffs of unstaged changes?
no option necessary
--cached
HEAD
--unstaged


How do you set an existing local branch to track a remote branch?
git branch --track localbranch remotebranch
git pull localbranch remotebranch
git branch --set-upstream localbranch remotebranch
git checkout -b localbranch remotebranch


What does the git merge option -s abbreviate?
--summary
--speedy
--strategy
--short


How do you get all submodules to clone after you have cloned a repository?
git submodule clone --all
git init submodule --recursive
git submodule update --init --recursive
git update submodules
git clone submodule --recursive


What is the common short-hand for deleting a branch in a remote repository?
git branch -d -r <repository> <branch>
git push <repository> :<branch>
git branch -D <repository>/<branch>
git rm <repository>/<branch>
git reset <repository> <branch>


What is the relationship between the --short and --dry-run options for git commit?
using --short implies --dry-run
--short and --dry-run cannot be used together
--dry-run works only if --short is also specified
--short works only if --dry-run is also specified


Which is the command to remove the latest stash from the stash list?
git stash clear
git stash pop
git stash rm
git stash drop
git stash remove


You stage two files, f1 and f2. Which command unstages only f1?
git reset HEAD f1
git reset HEAD -- f1
git reset f1
git reset -- f1


What is the difference between the -c and -C options for git commit?
-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


Normally "HEAD" stores the name of a branch, and it is said to be detached when:
it refers to an arbitrary commit that is not the tip of a branch.
it refers to a commit not on the master branch.
it is not on any branch.
it refers to anything but the most recent commit.
it refers to a commit not on the current branch.


True or false? "request-pull" a built-in Git command.
False
True


Which git rebase mode allows you to combine commits by 'squashing'?
Fast Forward
Interactive
Verbose
Squash


The command "git diff", without any additional arguments, shows...
differences between the working directory and the last commit to the master branch.
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 tracked by Git in the working directory that are not yet staged for the next commit.
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 tip of the current branch.


Which command will effectively preview a merge without making any changes?
git diff ...<remote>/<branch>
git diff HEAD..<remote>/<branch>
git merge --dry-run <remote> <branch>


What is the git diff option used to output the shortened diffs for a file foo.txt ?
git diff --stat foo.txt
git diff --verbose=false foo.txt
git diff --summary foo.txt
git diff --brief foo.txt


What does the git commit option -s abbreviate?
--speedy
--status
--signoff
--short


Which command allows you to get the blob of some file whether it is in a repository or not?
git encode
git hash
git blob
git hash-object
git object


Which of these two statements makes git use the file from the conflicting commit you are merging from?
git merge --theirs index.html
git checkout --theirs index.html


What is the abbreviation for the --dry-run option of git add?
-d
-n
-y
-r


What git commit option is equivalent to using both the -F and -e options?
-z
-t
-s
-n


How is it possible to record a merge from branch "oldBranch" into master without modifying master content?
git merge oldBranch & git reset --hard
git merge --strategy=ours oldBranch
it is not possible, git is not SVN.
git merge --record oldBranch


Which command obtains the common parent of two commits?
git merge-base <commit1> <commit2>
git fetch-base <commit1> <commit2>
git common-base <commit1> <commit2>
git common-parent <commit1> <commit2>


What does adding the -a option to git commit do?
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 known files and performs a commit
adds all changes from all files, known and unknown, 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


What is the git diff option to show the diffs of both staged and unstaged changes?
--both
no option necessary
HEAD
--cached