Git Flashcards

1
Q

Git init

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

$ git add filedirectoryName

A

Copies file or directory from working directory to staging area
//to add a specific file or directory, specify
$ git add filename
// for the entire directory
$ git add .

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

$ git Commit -m “commit message”

A

this command moves file/directory from staging area to repo(local).
-m flag is mandatory

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

$ git push origin <branchname></branchname>

A

sends a staged/commited file to a remote repo

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

Git push -u origin main http/::wwxxxxxxx

A

send Local Repo content to central repo(Github)

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

Git pull vs git clone

A

Git clone, when the repo is not in your Local Host

Git Pull, when you just want to mirror an updated change from a file in the remote repo

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

Git checkout

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

Pull Request

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

git log

A

gives a log of commits only

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

$ git branch -D branchname

A

Delet branch

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

$ git branch -a

A

List all branches, Local and remote

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

Git latest commit

A

“HEAD” is a reference to the currently checked out commit (i.e., the latest commit) in the repository. When you make a new commit, the HEAD is updated to point to the new commit, making it the latest commit in the branch you are currently on.

you can change head commit by using
$ git checkout <commit></commit>

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

origin/main

A

Remote centralized repo (GitHub.com)

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

git pull vs git clone

A

git clone: download content to my computer from the remote repo
git pull: just make a copy of the latest since i already have a previous version, in order to make further changes

Note: you cant do git pull for a repo you do not have locally

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

git fetch -a

A

The command git fetch -a is used in Git to fetch all remote branches from the remote repository. The -a flag is short for –all, which tells Git to fetch all branches, not just the ones you have locally. This command is useful when you want to update your local repository with all the latest changes from the remote repository.

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