Git Flashcards

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

git status

A

List which files are staged, unstaged, and untracked.

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

git log

A

Display the entire commit history using the default format.

git log shows the current HEAD and its ancestry. That is, it prints the commit HEAD points to, then its parent, its parent, and so on. It traverses back through the repo’s ancestry, by recursively looking up each commit’s parent.

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

git diff

A

Show unstaged changes between your index and
working directory.

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

git revert

<commit>
</commit>

A

Create new commit that undoes all of the changes made in

<commit>, then apply it to the current branch.
</commit>

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

git reset <file></file>

A

Remove <file> from the staging area, but leave the working directory
unchanged. This unstages a file without overwriting any changes</file>

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

git clean -n

A

Shows which files would be removed from working directory.
Use the -f flag in place of the -n flag to execute the clean.

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

git commit
–amend

A

Replace the last commit with the staged changes and last commit
combined. Use with nothing staged to edit the last commit’s message.

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

git rebase <base></base>

A

Rebase the current branch onto <base></base>. <base></base> can be a commit ID,
branch name, a tag, or a relative reference to HEAD.

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

git reflog

A

**Show a log of changes to the local repository’s HEAD.
**
doesn’t traverse HEAD’s ancestry at all. The reflog is an ordered list of the commits that HEAD has pointed to: it’s undo history for your repo. The reflog isn’t part of the repo itself (it’s stored separately to the commits themselves) and isn’t included in pushes, fetches or clones; it’s purely local.

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

git branch

A

List all of the branches in your repo. Add a <branch> argument to
create a new branch with the name <branch>.</branch></branch>

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

git checkout -b

<branch>
</branch>

A

Create and check out a new branch named <branch>.</branch>

Drop the -b flag to checkout an existing branch.

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

git merge <branch></branch>

A

Merge <branch> into the current branch.</branch>

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

git pull <remote></remote>

A

Fetch the specified remote’s copy of current branch and
immediately merge it into the local copy

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

git push

<remote> <branch>
</branch></remote>

A

Push the branch to <remote>, along with necessary commits and
objects. Creates named branch in the remote repo if it doesn’t exist</remote>

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

Git rebase

A

git rebase, on the other hand, is another way to integrate changes from one branch to another, but it works a bit differently. Instead of creating a new merge commit, git rebase moves or merges commits, creating a linear commit history.

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

Git reflog

A

That’s one of the great things about Git: it never really loses anything, even when performing history rewriting operations like rebasing or commit amending.

The reflog is a record that maintains a chronological history of significant changes made to the HEAD, branches, and tags. These changes consist of:

Commits
Checkouts
Merges
Rebases