chap 5 Flashcards

1
Q

Create and move to new branch

A

git checkout -b alvin
or
git branch alvin // to create but not move to

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

Check what branch you are on

A

git branch

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

Move to a different branch

A

git checkout branch-name

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

Save and undo current changes

so you can move to a different branch for example

A

git stash –keep-index
This saves and undoes your outstanding, unstaged changes while preserving your stag‐ ed changes in the index, and resets your working tree to match the index.

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

Retrieve the stashed changes

A

git stash pop

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

Move to another branch and merge the current branch

A

git checkout thebranch -m

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

Delete a branch

A

git branch -d alvin

git branch -D alvin // Force deletion

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

rename branch

A

git branch -m old new
There is no direct way to rename the corresponding branch in a remote repository, however; you must separately push the new branch and delete the old one:
$ git push -u origin new
$ git push origin :old

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