mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-31 16:14:53 +02:00
better level filenames and slightly less silly names for better usage
This commit is contained in:
parent
f5484ac7e7
commit
b768f7a083
20 changed files with 297 additions and 297 deletions
67
src/levels/rampup/relativeRefs2.js
Normal file
67
src/levels/rampup/relativeRefs2.js
Normal file
|
@ -0,0 +1,67 @@
|
|||
exports.level = {
|
||||
"goalTreeString": "{\"branches\":{\"master\":{\"target\":\"C6\",\"id\":\"master\"},\"bugFix\":{\"target\":\"C0\",\"id\":\"bugFix\"}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C1\"],\"id\":\"C3\"},\"C4\":{\"parents\":[\"C2\"],\"id\":\"C4\"},\"C5\":{\"parents\":[\"C3\"],\"id\":\"C5\"},\"C6\":{\"parents\":[\"C5\"],\"id\":\"C6\"}},\"HEAD\":{\"target\":\"C1\",\"id\":\"HEAD\"}}",
|
||||
"solutionCommand": "git branch -f master C6;git checkout HEAD~1;git branch -f bugFix HEAD~1",
|
||||
"startTree": "{\"branches\":{\"master\":{\"target\":\"C4\",\"id\":\"master\"},\"bugFix\":{\"target\":\"C5\",\"id\":\"bugFix\"}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C1\"],\"id\":\"C3\"},\"C4\":{\"parents\":[\"C2\"],\"id\":\"C4\"},\"C5\":{\"parents\":[\"C3\"],\"id\":\"C5\"},\"C6\":{\"parents\":[\"C5\"],\"id\":\"C6\"}},\"HEAD\":{\"target\":\"C2\",\"id\":\"HEAD\"}}",
|
||||
"hint": {
|
||||
"en_US": "You'll need to use at least one direct reference (hash) to complete this level"
|
||||
},
|
||||
"name": {
|
||||
"en_US": "Relative Refs #2 (~)"
|
||||
},
|
||||
"startDialog": {
|
||||
"en_US": {
|
||||
"childViews": [
|
||||
{
|
||||
"type": "ModalAlert",
|
||||
"options": {
|
||||
"markdowns": [
|
||||
"### The \"~\" operator",
|
||||
"",
|
||||
"Say you want to move a lot of levels up in the commit tree. It might be tedious to type `^` several times, so Git also has the tilde (~) operator.",
|
||||
"",
|
||||
"",
|
||||
"The tilde operator (optionally) takes in a trailing number that specifies the number of parents you would like to ascend. Let's see it in action"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "GitDemonstrationView",
|
||||
"options": {
|
||||
"beforeMarkdowns": [
|
||||
"Let's specify a number of commits back with `~`."
|
||||
],
|
||||
"afterMarkdowns": [
|
||||
"Boom! So concise -- relative refs are great."
|
||||
],
|
||||
"command": "git checkout HEAD~4",
|
||||
"beforeCommand": "git commit; git commit; git commit"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ModalAlert",
|
||||
"options": {
|
||||
"markdowns": [
|
||||
"### Branch forcing",
|
||||
"",
|
||||
"You're an expert on relative refs now, so let's actually *use* them for something.",
|
||||
"",
|
||||
"One of the most common ways I use relative refs is to move branches around. You can directly reassign a branch to a commit with the `-f` option. So something like:",
|
||||
"",
|
||||
"`git branch -f master HEAD~3`",
|
||||
"",
|
||||
"Moves (by force) the master branch to three parents behind HEAD."
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ModalAlert",
|
||||
"options": {
|
||||
"markdowns": [
|
||||
"To complete this level, move `HEAD`, `master`, and `bugFix` to their goal destinations shown."
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue