Git Quiz

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

A recommended workflow for using git includes all but one of the following:

commits should mostly be made in the master branch

In every software development project, there are always multiple different ___________(s) where work happens. Each feature, bugfix, experiment, or alternative of your work is actually a ____________ of its own.

context

When a developer starts working on a new feature, method, bug fix, etc., the developer should

create a new branch and check it out so that work will be completed in the new branch

Suppose you are working on a development project and have made changes to one or more files. What command would you issue from within your project working directory to stage the changes.

git add

When working in a git working copy (working directory), the developer can be working on _______ version(s) of a project at any given moment in time.

one

When dealing with remote repositories, the term origin often appears. This term refers to:

remote name

When a developer wishes to integrate work that exists in some branch with another branch, the process is called merging. What are the steps a developer should take to ensure this is done properly?

(1) Check out the branch that should receive the changes. (2) Call the "git merge" command with the name of the branch that contains the desired changes. (3) And, perhaps, handle merge conflicts

How does a developer get a repository onto her/his local system?

(a) If you have a project locally on your computer that is not yet under version control, you can initialize a new repository for this project. Be sure that the project is the current working directory and then do a git init.(b) If you're getting on board of a project that's already running, chances are there is a repository on a remote server (on the internet or on your local network). You'll then probably be provided with a URL to this repository that you will then "clone" (download / copy) to your local computer.

Suppose a developer working on a project (that has at least the branches master and contact-form) in the current working directory under git version control with master the current branch issues the command: git checkout contact-form What two things does this do for the developer?

(a) It makes "contact-form" the current HEAD branch. (b) It replaces the files in your working directory to match exactly the revision that "contact-form" is at.

What is a git repository?

A kind of database where your VCS stores all the versions and metadata that accumulate in the course of your project. In Git, the repository is just a simple hidden folder named ".git" in the root directory of your project. Knowing that this folder exists is more than enough.

Which of the following statements is false regarding use of local and remote git repositories?

Actual work on a project should always occur in the remote repository

Which of the following is a criterion for making a good commit?

All of the other answers are criterion for a good commit

Stashing helps you get a clean working copy. While this can be helpful in many situations, it's strongly recommended. Which of the following is not a good reason to stash?

Before checking out a different branch

Time spent on crafting a good commit message is time spent well: it will make it easier to understand what happened for your teammates (and after some time also for yourself). How should you craft this commit message?

Begin your message with a short summary of your changes (up to 50 characters as a guideline). Separate it from the following body by including a blank line. The body of your message should provide detailed answers to the following questions: What was the motivation for the change? How does it differ from the previous version?

Support for collaboration of two or more developers working on a single project include all but one of the following:

Especially supportive of Python, Java and C++ development

Describe the kind of repositories that git supports.

There are two kinds of repositories:A "local" repository resides on your local computer, as a ".git" folder inside your project's root folder. You are the only person that can work with this repository, by committing changes to it. A "remote" repository, in contrast, is typically located on a remote server on the internet or in your local network. No actual working files are associated with a remote repository: it has no working directory but it exclusively consists of the ".git" repository folder. Teams are using remote repositories to share & exchange data: they serve as a common base where everybody can publish their own changes and receive changes from their teammates.

Thoroughly describe what the git stash is.

Think of the Stash as a clipboard on steroids: it takes all the changes in your working copy and saves them for you on a new clipboard. You're left with a clean working copy, i.e. you have no more local changes. Later, at any time, you can restore the changes from that clipboard in your working copy - and continue working where you left off. You can create as many Stashes as you want - you're not limited to storing only one set of changes. Also, a Stash is not bound to the branch where you created it: when you restore it, the changes will be applied to your current HEAD branch, whichever this may be.

Commit is a key action in use of git repositories. Which of the following best states what a commit is or does?

a wrapper for a specific set of changes in a project under git version control

Suppose we want to correct the commit message for the last commit we just made. Fill in the blank for the git command option we should use. git commit --[a]__________ -m "The correct commit message"

amend

For any given project, there are always multiple contexts. What capability of git most contributes to being able to manage multiple contexts.

branches

GIT provides a mechanism that allows a developer to effectively manage/handle multiple (and many times parallel) contexts. Which of the following best describes it?

branches

Suppose we have been working on the file named GenericBag.java and have "foobarred" the code for one method -- it is now far worse than the code in that method was when we made the last commit. Complete the git command that will restore the file back to its exact state at the last commit of that file. git [c]___________ [a]____________ [b]______________

checkout, HEAD, GenericBag.java

What are the five parts of the Golden Rule of GIT Version Control?

commit only related changes write good commit messages use branches extensively never commit half-done work never amend published commits

Which of the following is an incorrect statement with respect to amending commits?

commits made prior to the last commit can be easily amended by specifying an additional parameter along with the amend option.

Suppose we are working in a working directory that is under git version control. Also suppose that we have a branch named bug-fix that has been completed, tracked and committed and merged into our master branch. Also assume that we have previously published our work to our remote named my-remote. What sequence of git commands should we issue to delete the bug-fix branch from both our local and from our remote repository.

git branch -d bug-fix git push my-remote --delete bug-fix

Suppose we are working in a local repository that already has defined a remote named my-remote. Also assume that we currently have checked out the branch master. Now we want to publish all the work done in the branch named mutators. Work in this branch has not previously been published on the remote repository. What sequence of commands should we use to get that work published?

git checkout mutators git push -u my-remote mutators

When a developer wishes to participate in an ongoing (or seminal) project, the developer should use which git command to bring that project to her/his local system.

git clone

Suppose a developer's local repository started out as a clone of a remote repository. That means information is stored in the local repository so that git knows how to connect/interact with the local repository. Suppose the remote repository is named data-abstraction, and since we cloned it, the local working directory is also named data-abstraction. Which of the following should be done first to update local repository information regarding changes in the remote?

git fetch data-abstraction

Which of the following allows a developer to view the history of changes made during development of a software project under git version control.

git log

When a developer wishes to save changes temporarily, what git command supports so doing?

git stash

Which git command lets the developer know which branch is the HEAD branch at any given moment?

git status

For a local repository to be updated with information from a remote repository, the developer should

issue a git pull or a git fetch

When one uses git pull remote/repository, what is not true of the target of the operation?

it is independent of a tracking connection

Suppose that we find our work in the current branch is so botched up that we want recover the state of all the files in the current working directory as of 5:00 pm when we made a commit yesterday. That was five commits in the past. Using git log we discover that the first eight characters of the commit hash code are 2b504bee. Fill in the blanks for the git command that will accomplish what we want. git [a]___________ [b]___________ [c]______________

reset, --hard, 2b504bee

Suppose we have just seriously foobarred our current working copy of a project under git version control, Now we want to restore our working copy of the entire project back to where it was at the last commit. Fill in the blanks for the appropriate git command to accomplish this. git [a]__________ [b]__________ [c]____________

reset, --hard, HEAD

In any given project that is under git version control, files can be in [a] _______ or [b] ________ state.

tracked, untracked


संबंधित स्टडी सेट्स

NUR 236 PrepU Chapter 50: Nursing Care of the Child With an Alteration in Behavior, Cognition, Development, or Mental Health/Cognitive or Mental Health Disorder

View Set

302 Hinkle Chapter 24: Management of Patients with Chronic Pulmonary Disease PrepU

View Set

Foundations of Neuroscience Exam 1

View Set

Chapter 15: "what is Freedom" Reconstruction 1865-1877

View Set

CHEM 1280 Lab Quiz 2 Definitions

View Set

Chapter 7: Founding a Nation, 1783-1791

View Set

Social Studies - 4 M.A.I.N. causes of WW1

View Set

Chapter 4: Resources, Capabilities, and Core Competencies

View Set