Git/ Github Flashcards

1
Q

What is a repository?

A

A central location where the project is being kept and where changes will be tracked.

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

In programming: What is a trunk?

A

The master branch of our project in the repository. The most stable and recent versions of our project resides.

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

In programming: What is the term ‘Staging a file’ mean?

A

Telling the source control system about the files within the repository we create.

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

In programming: What is the term ‘commit’?

A

A snapshot of your program

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

In programming: What does creating a new branch mean?

A

Branching away from the master branch so we can work on a new feature or bug fix without the risk of breaking something in our master branch.

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

Terminal: git status

A

list which (unstaged) filed have changed

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

Terminal: git diff

A

list (unstaged) changes to files

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

Terminal: git log

A

list recent commits

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

Terminal: git add fn

A

stage file

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

Terminal: git commit -m ‘message’

A

commit file

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

Terminal: git commit -am ‘message’

A

add/commit all changes from all tracked file (no untracked files) in one go.

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

Terminal: git reset filename

A

unstage file

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

Terminal: commit –amend -m ‘message’

A

alter the last commit (add any staged files, new comment)

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

Terminal: git reset –soft HEAD^

A

undo previous commit, put changes in staging

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

Terminal: git reset –hard HEAD^

A

Undo last commit and all changes

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

Terminal: git reset –hard HEAD^^

A

Undo two (^^) last commits and all changes

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

Terminal: git checkout – cats.html index.html

A

Undo all changes that were made to files cats.html and index.html

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

Terminal: git rebase –onto \^ HEAD

A

remove specific commit from repository. the \ in ^ is just an escape char to make zsh play nice and is not necessary if using bash.

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

git remote add origin git@example.com:example/petshop.git

A

add a remote repository

20
Q

git push -u origin master

A

push current local repo to remote. -u sets it to default for the future

21
Q

git remote -v show

A

show the available remote repositories that have been added

22
Q

git pull

A

checkout and merge remote changes in one go

23
Q

git fetch origin

A

update the local cache of the remote repository

24
Q

git remote -v update

A

bring remote refs up to date (and -v show which branches were updated)

25
Q

git status -uno

A

will tell you whether the branch you are tracking is ahead, behind or has diverged. If it says nothing, the local and remote are the same.

26
Q

git show-branch *master

A

will show you the commits in all of the branches whose names end in master (eg master and origin/master).

27
Q

git show remote origin

A

show localremote branch tracking and sync status

28
Q

git log HEAD..origin/master –oneline

A

shows commit messages

29
Q

git diff HEAD..origin/master

A

shows all changes on remote compared to local HEAD

30
Q

git branch

A

list currently existing branches

31
Q

git branch [branchname]

A

create new branch

32
Q

git checkout branchname

A

move to that branch

33
Q

git checkout -b branchname

A

create and checkout new branch in one go

34
Q

git branch -d branchname

A

remove branch

35
Q

git checkout master; git merge branchname;

A

conditions for fast-forward merge - nothing new on master between branch start/end points

36
Q

git fetch origin``git branch -r

A

list remote branches (after a fetch)

37
Q

git push origin :branchname

A

delete remote branch ‘branchname’

38
Q

git remote prune origin

A

clean up deleted remote branches (let’s say someone else deleted a branch on the remote)

39
Q

git show remote origin

A

show localremote branch tracking and sync status (duplicate info under “remote repositories”)

40
Q

git push heroku yourbranch:master

A

simple form

41
Q

git push heroku-staging staging:master

A

(localBranchName:remoteBranchName)

42
Q

git tag

A

list all tags

43
Q

git checkout v0.0.1

A

checkout code

44
Q

git tag -a v0.0.3

A

-m ‘Version 0.0.3’ add new tag

45
Q

git push –tags

A

push new tags to remote