Git Flashcards

Create, use, and explore file repositories (39 cards)

1
Q

Create a local repository folder from the remote repository at ‘https://me.github.com/myrepo’

Repo&raquo_space;> Commits&raquo_space;> Staged&raquo_space;> Workspace

A

git clone https://me.github.com/myrepo

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

Create a folder named ‘project’ with an empty local repository

Commits&raquo_space;> Staged&raquo_space;> Workspace

A

git init project

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

Link all local commits to the ‘origin’ branch of the remote repository at ‘https://me.github.com/myrepo’

A

git remote add origin https://me.github.com/myrepo

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

List staged, modified, and untracked files

Workspace Staged Committed

A

git status

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

Show differences between modified files and staged files

Workspace Staged

A

git diff

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

Show differences between staged files and committed files

Staged Committed

A

git diff –cached

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

Show differences between the committed branches ‘topic1’ and ‘topic2’

A

git diff topic1 topic2

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

Move a file named ‘file’ to the staged files

Workspace&raquo_space;> Staged

A

git add file

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

Commit all staged files with the note ‘Because’

Staged&raquo_space;> Committed

A

git commit -m “Because”

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

Add to previous commit by committing all staged files and replacing the note with ‘Because’

Staged&raquo_space;> Committed

A

git commit –amend -m “Because”

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

Apply changes made on a branch named ‘topic’ to the current commit to create a new commit

Committed&raquo_space;> Staged&raquo_space;> Workspace

A

git merge topic

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

Rewrite committed history up to but not including the commit that starts with 123456

Committed&raquo_space;> Staged&raquo_space;> Workspace

A

git rebase –interactive 123456

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

Upload commits to the remote repository

Committed&raquo_space;> Repo

A

git push

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

Remove the file named ‘file’ from the staged files

A

git rm –cached file

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

Remove all staged files

Committed&raquo_space;> Staged

A

git reset HEAD

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

Reset working files and staged files to the branch named ‘topic’

Committed&raquo_space;> Staged&raquo_space;> Workspace

A

git checkout topic

17
Q

Reset working file and staged file to committed file in branch named ‘topic’

Committed&raquo_space;> Staged&raquo_space;> Workspace

A

git checkout topic file

18
Q

Undo file changes committed in the commit that starts with ‘123456’

A

git revert 123456

19
Q

List all committed branches

20
Q

List all committed branches and all remote repository branches

A

git branch –all

21
Q

Create a new branch called ‘topic’ in the committed files starting at the current commit

A

git branch topic

22
Q

Reset staged files to committed files at the commit that starts with 123456

Committed&raquo_space;> Staged

A

git reset 123456

23
Q

Reset working files and staged files to committed files at the commit that starts with 123456

Committed&raquo_space;> Staged&raquo_space;> Workspace

A

git reset –hard 123456

24
Q

Apply current changes to the branch named ‘topic’ in the committed files and move to the new commit

Committed&raquo_space;> Staged&raquo_space;> Workspace

A

git rebase topic

25
List the contents of all stashes with their ID numbers
git stash list
26
Backup working changes and staged changes with an ID and reset working and staged files with committed files Workspace >>> Stash Staged >>> Stash Committed >>> Staged >>> Workspace
git stash push --include-untracked
27
Apply the stashed files labeled 'id' to the staged and working files Stash >>> Staged Stash >>> Workspace
git stash apply id
28
Delete stash labeled 'id'
git stash drop id
29
Delete all stashed changes
git stash clear
30
List all committed tags
git tag
31
Mark current commit with a `2018-11` tag
git tag 2018-11
32
Mark current commit with a 'v1.0.0' tag and a 'Note' note
git tag -a v1.0.0 -m "Note"
33
Upload committed tags to remote repository Committed >>> Repo
git push --tags
34
Show a condensed history graph of the committed files
git log --graph --oneline
35
Show the last three commits for the current branch
git log -3
36
Show detailed information about the commit that starts with 123456
git show 123456
37
Show the last person to touch each line of 'file'
git blame file
38
Show the history of git commands that affected the commit that starts with 123456
git reflog 123456
39
Create an empty local repository in the current folder Commits >>> Staged >>> Workspace
git init