Default Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What are annotated tags and what is the function?

A

Label that shows the state of the project.

git tag -a -m “I love cheesecake”

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

How to copy and paste in git bash console?

A

CTRL + Insert (copy) | SHIFT + Insert (paste)

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

Command to turn a folder into a GIT repository

A

git init

after complete try:
ls -a
to show subdirectories (-a for the hidden ones)

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

What does SHA-1 mean?

A

A 40 character revision identifier that is used in git. It is (almost unique) - meaning no oher input data should ever produce the same hash. However, the same input data should always produce exactly the same hash.
Every object that is processed by the git repository has a unique SHA-1, which allows us to control versions.

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

What are the objects in git?

A

Blobs
Trees
Commits
Annotated Tags

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

How to add files to git repository?

A

git add recipes/apple_pie.txt

git status

git commit -m “Recipe Added”

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

Concept of GIT as a map

A

Git is a map where the keys are SHA-1’s and the values are pieces of content

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

Commit the changes into your local repository

A
git commit -m "Comment" 
git status (to check the status)
git log (to check the logs)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What happens after a git checkout?

A

Git replaces files in the working area -> it changes to the content of the commit pointed at by the branch. Also: Moves the HEAD

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

How to see the content of a hash (low level plumbing command)?

A

git cat-file {SHA-1}

(you do not need to know the hash exactly, you may know just the beginning - git will open the correct object if there are not conflicts)

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

How do you force a push?

A

git push -f

(force push, as you can guess will overwrite the origin repository with your local versions of the project,
if used unwisely it might result in a loss of data)

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

What is a branch?

A

Branch in general understanding is just a reference to a commit. When working on a branch each commit will move the HEAD to the latest commit.
Before merging and pushing the project into origin, there might be need to get rid of all the conflicts.

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

What is the HEAD?

A
HEAD points us to the branch we are currently operating in.
it is the (*), which is visible when you git branch.
git checkout (allows us to switch between branches)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Three basic rules

A
  1. The current branch tracks new commits
  2. When you move to another commit, Git updates the working directory
  3. Unreachable objects are garbage collected
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How to list references in a local repository?

A

git show-ref master (show state of remote and origing branches)
git show-ref –heads (will show the position of the head and the hash of the commit)

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

What is the purpose of a Tag?

A

Tag is like a branch that doesn’t move. It shows the state of the projects. Tags can be divided into Annotated Tags and Unannotated Tags (Lightweight tags).

17
Q

What is the difference between Unannotated (Lightweight) Tags and Annotated Tags?

A

The difference between the commands is that one provides you with a tag message while the other doesn’t.
An annotated tag has a message that can be displayed with git-show(1), while a tag without annotations is just a named pointer to a commit.

18
Q

What are the platforms that you can chose, when you decide to use git as your source control?

A

GitHub, GitLab, Bitbucket

19
Q

What is the workflow when making changes in the git repository.

A

You can git add files to the staging area -> making them tracked with the commit. We have full control, so we can add 2/3 of files because the 3rd one is not ready.
Then we git commit -m ‘message about commit’.
Then we should git pull from the cloud repository and take care of merge conflicts if they happen.
Then we can finally push into repository.

20
Q

How do you add all the files that you have changed in a commit?

A

There is a shortcut

git commit -am