Git Flashcards

1
Q

Git

a place to hide modifications while you work on something else

A

stash

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

Git

save your local modifications to a new stash, and run git reset --hard to revert them

A

$ git stash save

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

Git

move changes from the specified stash into the workspace

A

$ git stash apply [stash]

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

Git

apply changes from the last stash and removes it

A

$ git stash pop

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

Git

list the stashes you currently have

A

$ git stash list

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

Git

show the changes recorded in the stash as a diff between the stashed state and its original parent

A

$ git stash show [stash]

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

Git

remove a single stashed state from the stash list

A

$ git stash drop [stash]

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

Git

remove all the stashed states

A

$ git stash clear

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

Git

local checkout

A

workspace

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

Git

display 1) paths that have differences between the index file and the current HEAD commit, 2) paths that have differences between the workspace and the index file, 3) paths in the workspace that are not tracked by git

A

$ git status

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

Git

display the differences not added to the index

A

$ git diff

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

Git

view changes in your workspace relative to the named commit or branch

A

$ git diff [commit or branch]

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

Git

add the current content of new or modified files to the index, staging that content for inclusion in the next commit

A

$ git add [file… or dir…]

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

Git

add the current content of modified (not new) files to the index

A

$ git add -u

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

Git

remove a file from the workspace and the index

A

$ git rm [file…]

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

Git

move a file in the workspace and the index

A

$ git mv [file…]

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

Git

commit all files changed since your last commit, except untracked files, and remove files from the index that have been removed from the workspace

A

$ git commit -a [-m message]

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

Git

update the file or dir in the workspace (does NOT switch branches)

A

$ git checkout [file… or dir…]

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

Git

match the workspace and the index to the local tree

A

$ git reset –hard

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

Git

switch branches by updating the index and the workspace to reflect the specified branch

A

$ git checkout [branch]

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

Git

create a branch and switch to it

A

$ git checkout -b [branch]

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

Git

merge changes from [branch] into current branch

A

$ git merge [commit or branch]

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

Git

revert all commits since the current branch diverged from [upstream] and then re-apply them one by one on top of changes from the HEAD of [upstream]

A

$ git rebase [upstream]

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

Git

integrate changes in the given commit into the current branch

A

$ git cherry-pick [commit]

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

Git

reverse commit specified by [commit] and commit the result

A

$ git revert [commit]

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

Git

download the repo specified by and checkout HEAD of the master branch

A

$ git clone [repo]

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

Git

incorporate changes from a remote repo into the current branch

A

$ git pull [remote-name]

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

Git

reset local repo and working tree to match a remote branch

A

$ git reset –hard [remote-name]/[branch]

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

Git

clean the working tree by recursively removing files that are not under version control, starting from the current dir

A

$ git clean

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

Git

cause git clean to perform a ‘dry run’ to see what would be deleted

A

$ git clean -n

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

Git

files you want to commit; also called “current directory cache”, “staging area”, “cache”, or “staged files”

A

index

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

Git

remove the specified files from the next commit; resets the index but not the working tree

A

$ git reset HEAD [file…]

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

Git

undo the last commit, leaving changes in the index

A

git reset –soft HEAD^

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

Git

view the changes you staged vs the latest commit

A

$ git diff –cached

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

Git

store the current contents of the index in a new commit along with a message describing the changes

A

$ git commit -m [message]

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

Git

modify the last commit with the current index changes

A

$ git commit –amend

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

Git

a subdirectory named .git that contains all of your necessary repository files - a git repository skeleton; typical branches: master, feature-x, bugfix-y

A

local repository

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

Git

show recent commits, most recent on top

A

$ git log

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

Git

git log option that adds branch and tag names on appropriate commits

A

$ git log –decorate

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

Git

git log option that includes more details (files changed, insertions, and deletions)

A

$ git log –stat

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

Git

git log option that shows commits made by a specific person

A

$ git log –author=[author]

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

Git

git log option that shows commits made after a certain date

A

$ git log –after=[“MMM DD YYYY”]

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

Git

git log option that shows commits made before a certain date

A

$ git log –before [“MMM DD YYYY”]

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

Git

git log option that shows commits involved in the current merge conflicts

A

$ git log –merge

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

Git

view the changes between two arbitraty commits

A

$ git diff [commit] [commit]

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

Git

list all existing branches

A

$ git branch

47
Q

Git

git branch option that includes remote branches

A

$ git branch -a

48
Q

Git

delete a specified branch

A

$ git branch -d [branch]

49
Q

Git

force delete a specified branch

A

$ git branch -D [branch]

50
Q

Git

create a new local branch that tracks a remote branch

A

$ git branch –track [new-branch] [remote/branch]

51
Q

Git

download objects and refs from another repo

A

$ git fetch [remote] [refspec]

52
Q

Git

update the server with your commits that are COMMON between your local copy and the server; local branches that were never pushed to the server in the first place are not shared

A

$ git push

53
Q

Git

push a new (or existing) branch to the remote repo

A

$ git push [remote] [branch]

54
Q

Git

push a new branch to a repote repository with a different name

A

$ git push [remote] [branch] : [branch]

55
Q

Git

versions of your project that are hosted on a network, ensuring all your changes are available for other developers; the default name is ‘origin’

A

upstream repository

56
Q

Git

list remote branches

A

$ git branch -r

57
Q

Git

remove a remote branch; literally ‘push nothing to this branch’

A

$ git push [remote] : [branch]

58
Q

Git

stash

A

a place to hide modifications while you work on something else

59
Q

Git

$ git stash save

A

save your local modifications to a new stash, and run git reset --hard to revert them

60
Q

Git

$ git stash apply [stash]

A

move changes from the specified stash into the workspace

61
Q

Git

$ git stash pop

A

apply changes from the last stash and removes it

62
Q

Git

$ git stash list

A

list the stashes you currently have

63
Q

Git

$ git stash show [stash]

A

show the changes recorded in the stash as a diff between the stashed state and its original parent

64
Q

Git

$ git stash drop [stash]

A

remove a single stashed state from the stash list

65
Q

Git

$ git stash clear

A

remove all the stashed states

66
Q

Git

workspace

A

local checkout

67
Q

Git

$ git status

A

display 1) paths that have differences between the index file and the current HEAD commit, 2) paths that have differences between the workspace and the index file, 3) paths in the workspace that are not tracked by git

68
Q

Git

$ git diff

A

display the differences not added to the index

69
Q

Git

$ git diff [commit or branch]

A

view changes in your workspace relative to the named commit or branch

70
Q

Git

$ git add [file… or dir…]

A

add the current content of new or modified files to the index, staging that content for inclusion in the next commit

71
Q

Git

$ git add -u

A

add the current content of modified (not new) files to the index

72
Q

Git

$ git rm [file…]

A

remove a file from the workspace and the index

73
Q

Git

$ git mv [file…]

A

move a file in the workspace and the index

74
Q

Git

$ git commit -a [-m message]

A

commit all files changed since your last commit, except untracked files, and remove files from the index that have been removed from the workspace

75
Q

Git

$ git checkout [file… or dir…]

A

update the file or dir in the workspace (does NOT switch branches)

76
Q

Git

$ git reset –hard

A

match the workspace and the index to the local tree

77
Q

Git

$ git checkout [branch]

A

switch branches by updating the index and the workspace to reflect the specified branch

78
Q

Git

$ git checkout -b [branch]

A

create a branch and switch to it

79
Q

Git

$ git merge [commit or branch]

A

merge changes [branch] from into current branch

80
Q

Git

$ git rebase [upstream]

A

revert all commits since the current branch diverged from [upstream] and then re-apply them one by one on top of changes from the HEAD of [upstream]

81
Q

Git

$ git cherry-pick [commit]

A

integrate changes in the given commit into the current branch

82
Q

Git

$ git revert [commit]

A

reverse commit specified by [commit] and commit the result

83
Q

Git

$ git clone [repo]

A

download the repo specified by and checkout HEAD of the master branch

84
Q

Git

$ git pull [remote-name]

A

incorporate changes from a remote repo into the current branch

85
Q

Git

$ git reset –hard [remote-name]/[branch]

A

reset local repo and working tree to match a remote branch

86
Q

Git

$ git clean

A

clean the working tree by recursively removing files that are not under version control, starting from the current dir

87
Q

Git

$ git clean -n

A

cause git clean to perform a ‘dry run’ to see what would be deleted

88
Q

Git

index

A

files you want to commit; also called “current directory cache”, “staging area”, “cache”, or “staged files”

89
Q

Git

$ git reset HEAD [file…]

A

remove the specified files from the next commit; resets the index but not the working tree

90
Q

Git

git reset –soft HEAD^

A

undo the last commit, leaving changes in the index

91
Q

Git

$ git diff –cached

A

view the changes you staged vs the latest commit

92
Q

Git

$ git commit -m [message]

A

store the current contents of the index in a new commit along with a message describing the changes

93
Q

Git

$ git commit –amend

A

modify the last commit with the current index changes

94
Q

Git

local repository

A

a subdirectory named .git that contains all of your necessary repository files - a git repository skeleton; typical branches: master, feature-x, bugfix-y

95
Q

Git

$ git log

A

show recent commits, most recent on top

96
Q

Git

$ git log –decorate

A

git log option that adds branch and tag names on appropriate commits

97
Q

Git

$ git log –stat

A

git log option that includes more details (files changed, insertions, and deletions)

98
Q

Git

$ git log –author=[author]

A

git log option that shows commits made by a specific person

99
Q

Git

$ git log –after=[“MMM DD YYYY”]

A

git log option that shows commits made after a certain date

100
Q

Git

$ git log –before [“MMM DD YYYY”]

A

git log option that shows commits made before a certain date

101
Q

Git

$ git log –merge

A

git log option that shows commits involved in the current merge conflicts

102
Q

Git

$ git diff [commit] [commit]

A

view the changes between two arbitraty commits

103
Q

Git

$ git branch

A

list all existing branches

104
Q

Git

$ git branch -a

A

git branch option that includes remote branches

105
Q

Git

$ git branch -d [branch]

A

delete a specified branch

106
Q

Git

$ git branch -D [branch]

A

force delete a specified branch

107
Q

Git

$ git branch –track [new-branch] [remote/branch]

A

create a new local branch that tracks a remote branch

108
Q

Git

$ git fetch [remote] [refspec]

A

download objects and refs from another repo

109
Q

Git

$ git push

A

update the server with your commits that are COMMON between your local copy and the server; local branches that were never pushed to the server in the first place are not shared

110
Q

Git

$ git push [remote] [branch]

A

push a new (or existing) branch to the remote repo

111
Q

Git

$ git push [remote] [branch] : [branch]

A

push a new branch to a repote repository with a different name

112
Q

Git

upstream repository

A

versions of your project that are hosted on a network, ensuring all your changes are available for other developers; the default name is ‘origin’

113
Q

Git

$ git branch -r

A

list remote branches

114
Q

Git

$ git push [remote] : [branch]

A

remove a remote branch; literally ‘push nothing to this branch’