part3 Git Flashcards

1
Q

what is git?

A

Git is a tool that helps you track changes in your files over time

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

what is the meaning of version control system ?

A

version control system means we can go back in time and work with a different version of our code base.

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

what is the difference between a local and a remote repository in git?

A

Local repository: This is the copy of your project that resides on your own computer. You work directly with files here, make changes, commit them (save snapshots), and manage versions locally.

Remote repository: This is a version of your project that is stored on a server, like GitHub or GitLab. It acts as a central hub where you can share your changes with others, collaborate on projects, and synchronize your work across multiple computers.

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

what are the three stages of the local repository?

A

Working Directory: This is where you modify files for your project.

Staging Area : contain new changes that will soon be committed.

Committed files: This is where Git permanently stores the committed changes as snapshots in the .git directory. Changes here are tracked and can be accessed or reverted as needed.

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

what are untracked files?

A

Untracked files in Git are files that Git is not currently keeping track of. These are typically new files that you’ve created in your project directory but haven’t yet told Git to start monitoring.

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

What command do you run to put your files in a staging area?

A

git add [file name]

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

what does the git restore command do?

A

It effectively reverts changes made to files, either by replacing them with the last committed version or by unstaging changes that have been added to the staging area.

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

what is the command to remove a file from the staging area?

A

git restore - -staged [file name]

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

what is a .gitignorefile?

A

A .gitignore file is a text file used by Git to specify which files and directories should be ignored and not tracked by Git

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

what does the command git log do?

A

The git log command displays a history of commits in a Git repository. Git shows you a list of commits starting from the most recent to the oldest when you run this command.

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

what is a branch in git?

A

It allows you to work on different versions of your project simultaneously without affecting the main codebase.

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

what is the default git branch ?

A

master/main

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

what is the command to create a new branch ?

what is the command to switch to another branch ?

command to create a branch and immediately switch to the branch?

command to delete a branch ?

A

git branch [branch name]

git checkout [branch name]

git checkout -b [branch name]

git branch -d [branch name]

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

what is the command to see a list of all available branches?

A

git branch

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

what are some of the platforms that can host a remote repository?

A
  • GitHub Gitlab Bitbucket and many more
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

what is the command to list all remote repositories?

A

git remote -v

17
Q

what is the command to push files from local to remote repository?

A

git push origin [branch name]

18
Q

what is a pull request?

A

a feature in GitHub that allows developers to propose changes to a project’s codebase.

19
Q

what is git fetch?

A

git fetch downloads changes from a remote repository (like GitHub) to your local repository.

20
Q

what command do you use if you want to switch to a new branch without loosing changes that are not committed yet?

A

git stash