Git Basics Flashcards

(19 cards)

1
Q

How to make a new directory?

A

mkdir directory

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

How do you initalize a directory to git?

A

git init

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

How to look at previous commits?

A

git log

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

How to look at the latest git commit?

A

git log -1

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

How to get the git commits compactly?

A

git log –oneline

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

How to configurate the git?

A

git config

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

How to create a new branch?

A

git branch new_branch

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

How to switch branches?

A

git switch diff_branch

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

How to switch and create a new branch?

A

git switch -c new_diff_branch

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

How to merge to the main branch?

A

git merge the_branch

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

How to delete a branch?

A

git branch -d add_classics

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

How to go back to the previous commit?

A

git reset –soft COMMITHASH

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

How to go to a previous commit and delete all the changes you made ahead of it?

A

git reset –hard COMMITHASH

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

What is the origin repo called if you have multiple?

A

main

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

How to ignore files so git doesn’t count them?

A

.gitignore

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

How to merge the remote repo with the branch?

A

git merge remote/branch

17
Q

How to ignore all txt files?

18
Q

What does !important.txt do in the .gitignore?

A

This isn’t ignored
- important.txt is not ignored

19
Q

What should be ignored?

A
  • ignore dependencies, personal/specific things, passwords, things that can be generated