Basic commands Flashcards

1
Q

What flag is used to both stage and commit tracked files within a working directory?

A

-a
as in:
git commit -a

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

How do you commit a file in git?

A

git commit

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

What command allow you to see the history within git?

A

“git log” or “git show”

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

How do you revert files from a modified state to the equivalent located within the repository

A

git checkout FILENAME

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

How do you unstage a file

A

git reset HEAD FILENAME

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

how to do you make a global alias within get

A

git global alias.ALIAS name “COMMAND GOES HERE”

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

How do update your git repository to accomodate for deletions

A

git add -u[pdate]

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

how to update your get repo to stage all changes (both deletions and renames etc)

A

git add -A

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

what is the command to inspect the global config file within the default editor

A

git config –global -e

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

What are the differences between “git add -A” “git add .” or “git add -u”

A

– git add -A
stages all changes (deletions, updates in names and modifications, and new files)

– git add .
stages new files and modifications, without deletions

– git add -u stages modifications and deletions, without new files

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

What is the command to save your work and recall it at a later date?

A

“git stash”

and to recall it. It’s “git stash pop”

“git stash pop”

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

What is the command to check the URLs associated with a local repository and it’s respective remote repository

A

git remote -v

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

How do you create a branch and then check into it with one command?

A

git branch -b “NAMEOFBRANCH”

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

What is the command to list all branches

A

git branch -a

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

what is the command to list all files?

A

git ls-files

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

how do you examine the differences between two branch within the command line (not with the diff.tool)

A

git difference BranchName1 BranchName2