From https://www.educative.io/ Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

How do you know which git repo is the main source?

A

All git repos are the same.
There is no concept no a central server that hold the “golden” source.
Instead, we maintain our own source. A server or host may be in charge but fundamentally they are all the same.

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

What are the 4 phases a file tracked by git will go through?

A

This image is missing some arrows, what are they?

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

Make cards for overall workflow for:

installing

Connecting

backing up

pushing

pulling

starting new

etc

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

What does git status do?

A

Displays the state of the repo and staging area

Gives info on whether a file has been changed or staged

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

What does git log do?

A

gives a log of commits

can use –graph to see branching

use –all to see all branches

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

Add and commit changes in one message (only for already tracked files)

A

git commit -a

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

What happens if you do and do not use the -m with a commit?

A

With, looks for a message within quotation marks

without it opens nano and you can type the message there

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

See the specific changes (not just whether a file has changed)

A

git diff

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

Clone a repo from the harddrive

Clone a repo from github

A

git clone folderName targetfoldername (don’t git init first)

git clone https://github.com/ianmiell/shutit (don’t git init first)

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

What does git reset do?

What flag does it use by default

A

unstages files

–mixed

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

What does git reset –hard do?

A

Reverts files on your computer to the last commit

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

Revert files on your computer to the last commit

A

git reset –hard

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

unstage a single file

unstage all files

A

git reset filenameanddirectory

git reset –mixed

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

View log but only the title

A

git log –oneline

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

view branching log

A

git log –graph

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

create a new branch at head

A

git branch branchname

17
Q

show all branch names

A

git branch

18
Q

view all branches in log

A

git log –graph –all

19
Q

The head can point to branch tag but not to arbitrary commits

t or f

A

f

it can point to arbitrary commits as a floating head

20
Q

A branch is the same as a tag

t or f

A

f

branches also have a history

tags do not

but are otherwise the same

21
Q

View all tags

A

git tag

22
Q

create a tag where the head is

create a tag somewhere else

A

git tag tagname

git tag tagname pointername (works with 6e3574ba4ff1b53dcbf776c6613037b156bc2e30)

23
Q

A branch is just a pointer

t or f

A tag is just a pointer

t or f

A

T

24
Q

Tags and branches can both maintain a branch as logged in git log

t or f

A

t

tags do it too apparently

25
Q

History info is lost in detatched head if you don’t have a pointer

t or f

A

f

it’s not lost it’s just not displayed by git log anymore

If you type in the commit code it will display

26
Q

Merge two branches

A

git merge branchname

27
Q

What does git merge attempt to do?

What if there are conflicts?

A

there are two branches, they have some common ancestor, merging takes all the changes from the common ancestor to the branch end and attempts to apply it to the head branch.

it makes all changes and automatically commits it all

If there are conflicts, add flags –no-ff –no-commit

It copies new files into the working directory and stages them

Changes files it adds new lines of code into old files (in a specific format) for the user to work through. It does not stage them.

28
Q

If there are conflicts on the same line of code, what happens?

A

You decide. Git pauses.

29
Q

How do you handle conflicts?

A

There are different workflows

Fix one of the files and commit with that one

Can leave the mess (but easy to forget it’s there)

30
Q

What happens if you try to commit when you haven’t worked through conflicting files?

A

It will stop you.

31
Q

How do you commit if you don’t want to work through conflicts yet?

A

Add the files.

You can commit with un

32
Q

What’s a pull request

A

A pull request – also referred to as a merge request – is an event that takes place in software development when a contributor/developer is ready to begin the process of merging new code changes with the main project repository.

33
Q

Save changes you’ve made without making a commit

A

git stash

34
Q

Load your stashed files

A

gish stash pop

35
Q

What happens to conflicts when popping?

A

Same as conflicts in merging. creates a file showing both versions

36
Q

Can you commit with unstaged popped files?

A

no

37
Q

How do you stash again for different changes?

A

It adds it to the stack of stashes

when you stash pop, it only deals with the top level

38
Q

How do you show the actual changes for a stash?

A

For most recent files:

git stash show

For more recent changes:

git stash show -p

For specific:

git stash show -p stash@{0}

git stash show –patch stash@{0}

–patch - to show what’s changes

39
Q

How do you ‘load’ a state from the middle of a stash stack?

A

git stash apply stash@{1}

git stash drop stash@{1}