1. Rewriting
Caution
|
For this workshop, you need to use repository git-next-level-workshop-rewriting.git (workshop resources).
|
1.1. Playing with rebase
1.1.1. Basics
See [rebaseInteractiveBasics] first and along the lab if needed.
1.1.2. Let’s start
-
Open your shell,
cd
to the git workshop repository, list all commits.
Caution
|
Respect the steps order of the following. If you don’t, you may change commit SHA-1 and not be able to find the SHA-1 given below. |
1.1.3. Easy ramp up
-
The three last commits ("Add jumbotron (partXXX)") are not consistent separately, merge these commits to create only one (and remove the useless (partXXX) part of the commit log).
-
(For reference: first commit SHA-1 shortened version =
fc3034f86
)
-
1.1.4. A bit harder
Commits
Let’s fix them! |
-
Start an interactive rebase
-
Edit the "Add footer + rename header menus" commit to split it in two distinct commits (hint:
git reset HEAD~1
andadd -p
):-
A first one with header
-
A second one with the footer part
-
-
Then, just merge the "Add style.css (footer)" commit into that second one you just created
Tip
|
you can choose to do the exercise above in one go, or do it in two successive interactive rebases. |
1.1.5. Smoothy landing
-
Commit
dbb8f26
has a spelling error. Fix it.
1.2. Playing with dangling commit
Execute this command :
git checkout fe9ba27
This commit has been modified during previous actions. But you can still check it out.
-
How does Git keep track of it?
-
Explain why.
1.3. Playing with "cherry-pick"
The current repository has a branch named "header-black-experiment". Execute :
git checkout header-black-experiment
-
List all commits.
-
Using cherry-pick command, try to retrieve commit edcdd0a on the master branch