Git Flashcards

Learn how to use git

1
Q

What is VCS

A

A Version Control System is a tool to manage changes over time to some files.

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

What differences exist between a DVCS and a CVCS

A

A Centralized Version Control System has a central server to handle most operations like retrieving history, committing and merging, meanwhile Distributed ones, make those operations locally since it has entire snapshots in local clones.

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

Differences between deltas and snapshots

A

Deltas storage the difference between versions while snapshots storage the entire file for each version (not the entire project).

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

What is a checksum

A

A value calculated from some data with a specific algorithm to validate that the data was not corrupted or changed while it was being transmitted.

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

The three states of files in Git

A

Modified, Staged, Committed

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

The three areas of Git

A

Working three, staging area or index, .git directory

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

What is git config

A

A command that helps us to get and set configuration at different levels by reading and writing to specific text files

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

Where are located the config files of git

A

[path]/etc/.gitconfig (system level, normally needs admin privileges)

~/.gitconfig or ~/.config/git/config (user level, set with –global flag)

./.git/config (repository level, default or with –local option)

In windows there is a system config at C://ProgramData/Git/config (git -f)

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

What is the output of git config –list

A

All configuration resolved for git at the current directory, it can contain duplicated keys.

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

What is the output of git config –list –show-origin

A

The show origin flag makes the output show form where the config is being red.

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

Which command in unix can change the editor to emacs at user level

A

git config –global core.editor emacs

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

When setting the editor in windows, what considerations are needed

A

We need to specify the absolute path to the executable

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

Is glob patterns unified across different tools?

A

Actually no, there are different rules , git follows the standard glob rules from UNIX original tool and some extra rules and it works stable in different OS.

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

In what status can a file be in Git

A

Untracked
Unmodified
Modified
Staged

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

What command is used to track, and stage files?

A

git add <options> <glob></glob></options>

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

What is the utility of staging files

A

To check if some secret, bin or generated files/folders are about to being committed, you prevent saving them to the Git database by error.

17
Q

What is git status command used for

A

To show the current status of the files in the working three and index.

17
Q

What does represent the columns in the output of the git status -s command

A

The first column is the working three status and the second column is the index status.

18
Q

Does the glob patterns in .gitignore apply recursively?

A

Yes

19
Q

How can we avoid reclusively in .gitignore

A

prefixing a “/”

20
Q

git diff by default what compares

A

It compares unstaged changes (not untracked).

21
Q

git diff –staged what compares

A

staged changes vs last commit

22
Q

What is the difference between deleting the file form the working three and using git rm

A

Removing the file changes the working three , git rm deletes the file and also adds to stage the delete change

23
Q

What is the difference between moving a file and using git mv

A

git mv not only moves the file, but also adds the change to staging

24
Q

What is the command to revert changes that were staged

A

git restore –staged

25
Q

How to remove files that you accidentally staged

A

git rm –cached <glob></glob>

26
Q

What does git log –one-line –graph

A

Prints in reverse chronological order the list of commits in one line format and not all 40 chars of the checksum with a ASCII representation of the branches.

27
Q

What does git log -p do

A

It prints also the patches, meaning the changes or the diff for each commit

28
Q

What does git log -S functionName do

A

The “pickaxe” option filters only commits where its patch content has the functionName in this case

29
Q

What does git log –no-merges

A

Does not show the merge commits

30
Q

About the –since and –until options , what do they do?

A

Filter with time limits like 2.weeks fromat or “2008-01-15”

31
Q

How we can filter with git log by author and commit content

A

–author and –grep

32
Q

What happens if we set more than one –author and more than –grep filter when using git log

A

The filter matches any of the authors used and any of the grep filters, except is combined with –all-match

33
Q

Is it possible to use git log with path files?

A

Yes, with a – before path to file

34
Q
A