Wednesday, December 16, 2015

Git test answers of 2016.

Find Complete and recently updated Correct Question and answers of Git. All Answers updated regularly with new questions. Upwork Git test answers of 2016.



Question:* What command creates a git repository in your current directory?

Answer: • git init

Question:* What command undoes all changes since the last commit?

Answer: • git reset

Question:* What shortcut creates and checks out a branch simultaneously?

Answer: • git checkout -b <branchname>

Question:* Who invented Git?

Answer: • Linus Torvalds

Question:* How would one add Remote Repositories?

Answer: • git remote add [shortname] [url]

Question:* Which file in a git repository specifies intentionally untracked files that git should ignore?

Answer: • .gitignore

Question:* What is the main branch of a git repo commonly called?

Answer: • master

Question:* How many remote servers can 1 Git repo pull changes from?

Answer: • No Limit

Question:* What file is used inside of a repository, to list files that should be ignored by git?

Answer: • .gitignore

Question:* What does adding the -m option to git commit do?

Answer: • Uses the given message as the commit message

Question:* What is the command for displaying the version of git being used?

Answer: • git --version

Question:* Is possible to have a global .gitignore file?

Answer: • Yes

Question:* What is the command for viewing a list of recent commits?

Answer: • git log

Question:* How do you determine the current state of the project?

Answer: • $ git status

Question:* What is the command for switching branches?

Answer: • git checkout <branch name>

Question:* What is the correct way to add multiple files to the staging area?

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

Question:* How do you add all files in current directory to git repository?

Answer: • git add .

Question:* The following command does what; $ git commit -am "Commit"

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

Question:* Which command shows you the version of your git installation.

Answer: • git --version

Question:* How do you retrieve changes from a remote repo?

Answer: • git pull origin master

Question:* You want to revert 'notes.txt' to the version in the most recent commit.

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

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

Answer: • git diff foo.txt

Question:* Which command deletes the branch named "stinky" regardless of merge status ?

Answer: • git branch -D stinky

Question:* How do you stage all changes?

Answer: • git add .

Question:* How can I get the commit ID?

Answer: • git log

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

Answer: • git reset --hard HEAD^

Question:* A staged file is

Answer: • A file added to the index

Question:* How do you undo all changes since your last commit?

Answer: • git reset --hard

Question:* What option suppresses output for git rm?

Answer: • --quiet

Question:* When pushing to a remote server, what is the only type of merge that is accepted by default?

Answer: • Fast-Forward

Question:* What is the default text editor used by git?

Answer: • system default

Question:* How to display a list of configuration parameters?

Answer: • git config -l

Question:* Which command will show what revision and author last modified each line of a file?

Answer: • git blame

Question:* How do you add another git repository as a directory of your repository

Answer: • git submodule add <repository> <local directory>

Question:* What git feature allows you to embed separate repos?

Answer: • submodules

Question:* Which one of the following commands lists REMOTE branches only?

Answer: • git branch -r

Question:* `git rebase <upstream>` will:

Answer: • 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>)

Question:* How do you add only certain parts of a file to the index?

Answer: • git add -p

Question:* What's the purpose of 'git bisect' ?

Answer: • Find the commit which introduced a bug

Question:* Which command removes file foo.txt from the index but not from the working directory?

Answer: • git rm --cached foo.txt

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

Answer: • All of these

Question:* What is the "git status" option used to output the shortened project status?

Answer: • -s

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

Answer: • --graph

Question:* Which command will move the changes from the last commit into in the stage area?

Answer: • git reset --soft HEAD^

Question:* Which of these commands alters existing commits?

Answer: • rebase

Question:* Which command creates a new commit that undoes the changes in the most recent commit?

Answer: • git revert HEAD

Question:* What is the git diff option to show the diffs of unstaged changes?

Answer: • no option necessary

Question:* git mv is equivalent to what sequence of commands?

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

Question:* What does the git merge option -s abbreviate?

Answer: • --strategy

Question:* What is the common short-hand for deleting a branch in a remote repository?

Answer: • git push <repository> :<branch>

Question:* How do you get all submodules to clone after you have cloned a repository?

Answer: • git submodule update --init --recursive

Question:* What is the relationship between the --short and --dry-run options for git commit?

Answer: • using --short implies --dry-run

Question:* You stage two files, f1 and f2. Which command unstages only f1?

Answer: • git reset HEAD -- f1

Question:* How do you set an existing local branch to track a remote branch?

Answer: • git branch --set-upstream localbranch remotebranch

Question:* Which command will effectively preview a merge without making any changes?

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

Question:* The command "git diff", without any additional arguments, shows...

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

Question:* Which git rebase mode allows you to combine commits by 'squashing'?

Answer: • Interactive

Question:* What is the difference between the -c and -C options for git commit?

Answer: • -c invokes the editor while -C does not

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

Answer: • git diff --stat foo.txt

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

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

Question:* What does the git commit option -s abbreviate?

Answer: • --signoff

Question:* What is the abbreviation for the --dry-run option of git add?

Answer: • -n

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

Answer: • git hash-object

Question:* Which of these two statements makes git use the file from the conflicting commit you are merging from?

Answer: • git checkout --theirs index.html

Question:* What git commit option is equivalent to using both the -F and -e options?

Answer: • -t

Question:* How is it possible to record a merge from branch "oldBranch" into master without modifying master content?

Answer: • git merge --strategy=ours oldBranch

Question:* Which command obtains the common parent of two commits?

Answer: • git merge-base <commit1> <commit2>

Question:* What does adding the -a option to git commit do?

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

Question:* What is the git diff option to show the diffs of both staged and unstaged changes?

Answer: • HEAD



No comments:

HTML5 Upwork (oDesk) TEST ANSWERS 2022

HTML5 Upwork (oDesk) TEST ANSWERS 2022 Question: Which of the following is the best method to detect HTML5 Canvas support in web br...

Disqus for upwork test answers