Git Flashcards

1
Q

1.What does git remote add origin do? 2.Why is this important?

A

1.It adds a remote server that we back our code up onto when we run git push.
2. Important because we want a back up of the code in case our local system explodes.

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

1.What is the difference between commit and an add? 2.Why do you do one or the other?

A
  1. Add: when we tell git which file we’re ready to put in a commit. It happens first.
  2. Commit: we store a snapshot of the added code and directory structure to git, when we’re ready to record the changes we made.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a timeline?(name pointers that are important in the timeline)

A

Timeline is many commits. It represents how the files change over time.
-Head: the commit your system is currently emulating
-Branch(main): the most recent commit

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

What does git init do?

A

Git init initialized a file structure.
Running git init connects a folder to git.
When you hook up a folder to git init, it adds a dot-file containing the snapshots of your code and makes the system come together.

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

What does git add do?

A

Git add makes a copy of the file in staging.
-For things that are getting ready(staged) for changes
-Each added file is identified by a hash which is calculated from its contents.
-Different file contents = different hash

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

What does git commit do?

A

Git commit stores these objects in small file system managed by git.
-committing means putting the blobs together into a large objects called commits
- commits keep larger snapshots of the code base such as directory structure.

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

What does “~” mean?

A

Home

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

What is the default branch name ?

A

Main

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

What does git status do?

A

Tells us what’s going on in a folder.

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

What does pushing do to a local repository?

A

Push syncs (or copies) a local repository to a remote one.

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

What does pulling do in the remote repository?

A

Pull sync your local repository with a remote repository. It copies the files over and the directory structure.

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

What does cloning do?

A

Downloads the entire timeline to go towards the local repository.

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

What does checkout let us do when navigating the commit history with your HEAD.

A

Checkouts lets us move around in the timeline.

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

True or false?Whatever HEAD points to, The files on the system won’t be identical to those commit.

A

False. They are identical to those commit.

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

Why do we create many branches in a local repository?

A

To organize changes

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

What does git fetch do?

A

Copies remote commit , only the new stuff

17
Q

What does origin mean? What does HEAD mean?

A

Original is another word for the remote. It is the remote repo we back our code onto. Head is a pointer to the commit in the timeline that your(Local/Client) computer on it.

18
Q

Describe to me the Git workflow. When do you add, commit? When do you push or pull?

A

You gut pull when you sit to start working. It syncs your computer with a remote computer. You add and commit files when you’ve made a tangible unit of the progress of the codebase.