git functions Flashcards

1
Q

split last unpushed commit into several commits

A

git reset HEAD~ -> build commits anew

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

force push branch

A

git push -f

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

combine multiple commits into one

A

git rebase -i HEAD~(NoOfCommitsFromLast)
git rebase -i “revision number”^

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

show last x commits

A

git log -n x

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

delete local branch

A

git branch -d “branchname”

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

create new git repository

A

git init –bare –shared

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

copy remote git repository to local

A

git clone

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

Move commit from one branch to another

A
  • get git hash of commit through git log
  • move to branch without commit
  • git cherry pick commit hash
  • revert other branch to commit before
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what are the three trees in git?

A

HEAD
Index
Working directory

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

in git, what is HEAD?

A

A Pointer, that points to the currently checked out branch, and through that the last commit on the branch

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

in git, what is the INDEX?

A

The staging area

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

how does one get the git hash of a compiled executable?

A

“executable” –program-version

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