Module 3 Flashcards

Remote Repositories

You may prefer our related Brainscape-certified flashcards:
1
Q

How to clone a repository from Github’s site?

A

git clone <URL>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to commit all files change in the working tree in one step?

A

git commit -a -m "insert commit message"

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

git config --global credential.helper cache allows us to configure the credential helper, which is used for …what?

A

Allowing automated login to GitHub.

I provide credentials once and then will not have to do it again for a limited time period.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Name the command that gathers all the snapshots we’ve taken and sends them to the remote repository.

A

git push

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does git remote -v do?

A

Shows the URLs for fetch and pull associated with remote origin.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How can I check if my local repo is out of sync with a remote repo?

A

git remote show origin

Out of date = commits made that aren’t incl. in my local repo

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What’s the main difference between git fetch and git pull?

A

git fetch fetches remote updates but doesn’t merge; git pull fetches remote updates and merges.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is does git remote show origin do?

A

It shows additional information on the remote repository. By default, git call the remote repo as origin.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

If we want to make a change to a remote branch, what must we do?

A

Pull the remote branch, merge it with the local branch, then push it back to its origin.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Interpret the output from the command git remote show origin shown below

A

“Local out of date” tells me that my local repo is out of sync with the remote repo, meaning someone pushed changes (commits) after I pulled info from the remote repo.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Is the following statement true or false?

Git keeps remote (origin) and local branches in sync at all times

A

False. I can check sync status through git remote show origin and sync by doing git pull or git push

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does git fetch do? What is the purpose of using it?

A

Fetch commits from remote repo and copy them to my remote branch.
As it download to the remote branches instead of my local branches, it won’t disrupt my work.
I can use git checkout to switch my working tree from local to remote branch.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Interpret the screenshot below

A

Both git log origin/master and git status show me that my local master branch is out of sync to origin/master, namely, it is 1 commit behind it

I will need to do git merge origin/master from my local master branch.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Interpret the screenshot below

A

Local master and remote origin/master branches are in sync.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What should you do with the conflict markers shown below when resolving a merge conflict?

A

Remove all of the conflict markers and only leave the code as it should be after the merge.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How do you switch to a new local branch?

A

git checkout -b <branch name>

17
Q

What does “git rebase refactor” do?

A

Move the current branch on top of the refactor branch

18
Q

What command would we use to change the base of the current branch?

A

git rebase <branchname>

19
Q

If you’re making changes to a local branch while another user has also made changes to the remote branch, which command will trigger a merge?

A

git pull

20
Q

What is one reason for using rebase instead of merge?

A

When I want to keep a linear commit history.

21
Q

If there is a new branch on the remote repo that I am not currently tracking, how can I start tracking it on my local repo?

A

git checkout <branch_name>

22
Q

In order to get the contents of a remote branch without automatically merging, which of these commands should we use?

A

git remote update

23
Q

If we need to find more information about a remote branch, which command will help us?

A

git remote show origin

24
Q

What command will download remote branches from remote repositories without merging the content with your current workspace automatically?

A

git fetch

25
Q

What type of merge creates a new merge commit?

A

An explicit merge

Fast-forward is a type of implicit merge

26
Q

What method of getting remote contents will automatically merge the remote branch with the current local branch?

A

git pull

27
Q

What is the origin in Git?

A

origin is an alias for the URL of a remote from which a repo was originally cloned.

Git associates a remote URL with a name, and your default remote is usually called origin

When you do a git clone <url>, url is automatically added to your local repo under the name origin.

28
Q

What happens when I run the following command
git push origin <branch name>

A

It means push everything from my local master to the remote named origin.

The structure of this command is, of course, more general - the more general form is git push -u <remote> <branch>, which will push the branch named branch to the designated remote, creating it at the far end if the remote doesn’t already have it (that’s what the -u flag does).

29
Q

What is a remote repository?

A

Remote repositories are versions of your project that are hosted on the Internet or network somewhere.

https://git-scm.com/book/ms/v2/Git-Basics-Working-with-Remotes