Git Commands Flashcards

1
Q

git config –global user.name “[firstname lastname]”

A

set a name that is identifiable for credit when review version history

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

git config –global user.email “[valid.email]”

A

set an email address that will be associated with each history marker

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

git config –global color.ui auto

A

set automatic command line coloring for Git for easy reviewing

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

git init

A

initialize an existing directory as a git repository

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

git clone [url]

A

retrieve an entire repository from a hosted location via URL

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

git status

A

show modified files in working directory, staged for your next commit

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

git add [file]

A

add a file as it looks now to you next commit (stage)

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

git reset [file]

A

unstage a file while retaining the changes in the working directory

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

git diff

A

diff or what is changed but what is not staged

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

git diff –staged

A

diff of what is staged but not yet committed

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

git commit -m “[descriptive message]”

A

commit your staged content as a new commit snapshot

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

git branch

A

list your branches. a * will appear next to the currently active branch

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

git branch [branch-name]

A

create a new branch at the current commit

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

git checkout

A

switch to another branch and check it out into your working directory

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

git merge [branch]

A

merge the specified branch’s history into the current one

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

git log

A

show all commits in the current branch’s history

17
Q

git log

A

show the commit history for the currently active branch

18
Q

git log branchB..branchA

A

show the commits on branchA that are not on branchB

19
Q

git log –follow [file]

A

show the commits that changed file, even across renames

20
Q

git diff branchB…branchA

A

show the diff of what is in branchA that is not in branchB

21
Q

git show [SHA]

A

show any object in Git in human-readable format

22
Q

git rm [file]

A

delete the file from project and stage the removal for commit

23
Q

git mv [existing-path] [new-path]

A

change an existing file path and stage the move

24
Q

git log –stat -M

A

show all commit logs with indication of any paths that moved

25
logs/*.notespattern*/
Save a file with desired patterns as .gitignore with either direct stiring matches or wildcard globs
26
git config --global core.excludefile [file]
system wide ignore pattern for all local repositories
27
git remote add [alias] [url]
add a git URL as an alias
28
git fetch [alias]
fetch down all the branches from that Git remote
29
git merge [alias]/[branch]
merge a remote branch to your current branch to bring it up to date
30
git push [alias] [branch]
merge a remote branch into your current branch to bring it up to date
31
git pull
fetch and merge any commits from the tracking remote branch
32
git rebase [branch]
apply any commits of current branch ahead of the specified one
33
git rest --hard [commit]
clear staging area, rewrite working tree from specified commit
34
git stash
save modified and staged changes
35
git stash list
list stack-order of stashed file changes
36
git stash pop
write working from top of stash stack
37
git stash drop
discard changes from the top of stash stack