Getting Started with Git2 Flashcards

(31 cards)

1
Q

What are 3 possible stages of a file?

A
  1. Committed
  2. Modified
  3. Staged
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does it mean that a file is in “Committed” stage?

A

Data in this file is stored in local DB in the project.

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

What does it mean that file is “Modified” stage?

A

It means that the file has been changed since the last time it was committed in the local db.

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

What does it mean that he file is in Staged state?

A

Changes are marked to be committed.

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

3 main parts of Git project?

A
  1. .git directory (Repository)
  2. working directory (checkout of 1 version of a project)
  3. Staging area (Index) - used to build a commit
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How to list all settings in Git config?

A

git config –list

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

How to show username from git config?

A

git config user.name

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

how to get help for “config” command in git?

A

git help config

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

How to add existing repo to remote origin?

A

git remote add origin __link__

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

How to push initial commit to origin?

A

git push -u origin master

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

How to authenticate using SSH?

A

Generate ssh key-pair using “ssh-keygen”.
Copy id_rsa.pub to ssh settings page in github.

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

What happens when you modify and stage a file, and then change it afterwards and call git status?

A

It appears in both modified/new file state and in untracked, since what you staged is a snapshot in time of a file.

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

What are the 3 columns of git status -s output?

A
  1. Status in “staging” area
  2. Status in “working directory”
  3. file name
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How to commit while skipping adding to staging state?

A

git commit -a -m “message”

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

How to see a list of commits?

A

git log

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

How to see a simpler view of git commits?

A

git log –oneline

17
Q

How to see a detail view of git commits?

A

git log –stat

18
Q

How to see the most detailed view of git commits?

A

git log –patch

19
Q

How to tell git to not track a file anymore and delete it locally?

20
Q

How to tell git to not track a file but leave it locally?

A

git rm –cached file

21
Q

How to rename a file in git?

A

git mv file newfile

22
Q

How to create a new branch?

A

git checkout -b branchName

23
Q

git-school.github.io/visualizing-git

24
Q

how to create new WIP snapshot?

25
How to see a list of git stashes?
git stash list
26
how to restore git stash?
git stash popp
27
How to merge new_branch to master branch?
1. Checkout to master 2. git merge new_branch
28
what does git reset (--mixed) commit# does?
It moves all commits from commit# to working directory
29
30
31