Understanding Git Flashcards

1
Q

what is a Repository aka repo

A

Git Repo is a working space which tracks and manages files within a folder.

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

How does a repo work?

A

Anytime we want to to use Git with a project, app, etc we need to create a new git repository. We can have as many repos o n our machine as needed, all with separate histories and contents.

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

What is git status?

A

Gives us information on the current status of a git repository and its content.

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

What is git init?

A

it is used to create a new git repository.
Before we can do anything git-related, we must initialize a repo first

note : this is done once per project initialize the repo in the top-level folder containing your project.

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

A common mistake
:-Git tracks all Directories and all Nested Subdirectories
What not to do?

A

DO NOT INIT/initialize A REPO INSIDE OF A REPO
Before running git init, use git status to verify that you are nit currently inside of a repo

note:
make a folder, for a project and then initialize git in that folder don’t have a git repo on your desktop or your documents folder or the entire machine will be tracking everything. Have one repo per project
Always run git status

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

What is commit?

A

It is a checkpoint, or a snapshot of a project with new changes at a moment in time along with with a little message like (add top Navbar or Add fist row ) They are referred to as repo.
-Add a new feature then commit.-
Note:
Git commit is not Just about saving files, we have to male changes first, and save them to a file before we can even commit– NB–
SAVE CHANGES GROUP THEM TOGETHER INTO A COMMIT

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

Staging changes with Git Add

A

ADDING -> We use git add command to stage changes to be committed (its a way of telling git, please include this changes in our next commit.

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

How do use the git commit ?

A

We use the git commit command to actually commit changes from the staging area
Note:
we have to provide a commit message to summarize the changes. and work snapshotted in the commit.

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

what is the git commit -m command

A

git commit -m “my message”
Note:
The -m flag allows us to pass in an inline commit message, rather than launching a text editor

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

What is the git log command

A

Git log is a utility tool to review and read a history of everything that happens to a repository

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

git add

A

The git add command adds a change in the working directory to the staging area. It tells Git that you want to include updates to a particular file in the next commit. However, git add doesn’t really affect the repository in any significant way—changes are not actually recorded until you run git commit .

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

What is .git ignore ?

A

It is a command that we use, to not include some files that we don ‘t need in our main project.

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

What are some of the files that we .git ignore/ do not commit?

A

.Secrete API’s keys files (DS_STORE ON MAC)
.Operating systems.
.Dependancies & packages.

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

What is Branch?

A

(Are essential part of git )
Think of a branch as alternative timelines for a project
They enable us to create separate context where we can try new things, or even work on multiple ideas in parallel.
Note;
If we make changes on one brach, they do not impact the other branches (unless we merge the changes)

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

What is a Master Brach?

A

In 2020 Github renamed the default brach as master branch
Note:
in git, we are always working on a branch the default name is master branch

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