mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-07 21:24:26 +02:00
Issue #141 Level explaining git tags
This commit is contained in:
parent
625c15d51e
commit
1753f61cc3
2 changed files with 67 additions and 1 deletions
|
@ -20,7 +20,8 @@ exports.levelSequences = {
|
||||||
mixed: [
|
mixed: [
|
||||||
require('./mixed/grabbingOneCommit').level,
|
require('./mixed/grabbingOneCommit').level,
|
||||||
require('./mixed/jugglingCommits').level,
|
require('./mixed/jugglingCommits').level,
|
||||||
require('./mixed/jugglingCommits2').level
|
require('./mixed/jugglingCommits2').level,
|
||||||
|
require('./mixed/tags').level
|
||||||
],
|
],
|
||||||
advanced: [
|
advanced: [
|
||||||
require('./rebase/manyRebases').level,
|
require('./rebase/manyRebases').level,
|
||||||
|
|
65
src/levels/mixed/tags.js
Normal file
65
src/levels/mixed/tags.js
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
exports.level = {
|
||||||
|
"goalTreeString": "{\"branches\":{\"master\":{\"target\":\"C5\",\"id\":\"master\",\"remoteTrackingBranchID\":null},\"side\":{\"target\":\"C3\",\"id\":\"side\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C2\"],\"id\":\"C3\"},\"C4\":{\"parents\":[\"C1\"],\"id\":\"C4\"},\"C5\":{\"parents\":[\"C2\",\"C4\"],\"id\":\"C5\"}},\"tags\":{\"v1\":{\"target\":\"C2\",\"id\":\"v1\",\"type\":\"tag\"},\"v0\":{\"target\":\"C1\",\"id\":\"v0\",\"type\":\"tag\"}},\"HEAD\":{\"target\":\"C2\",\"id\":\"HEAD\"}}",
|
||||||
|
"solutionCommand": "git tag v1 side~1;git tag v0 master~2;git checkout v1",
|
||||||
|
"startTree": "{\"branches\":{\"master\":{\"target\":\"C5\",\"id\":\"master\",\"remoteTrackingBranchID\":null},\"side\":{\"target\":\"C3\",\"id\":\"side\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C2\"],\"id\":\"C3\"},\"C4\":{\"parents\":[\"C1\"],\"id\":\"C4\"},\"C5\":{\"parents\":[\"C2\",\"C4\"],\"id\":\"C5\"}},\"tags\":{},\"HEAD\":{\"target\":\"master\",\"id\":\"HEAD\"}}",
|
||||||
|
"name": {
|
||||||
|
"en_US": "Git Tags"
|
||||||
|
},
|
||||||
|
"hint": {
|
||||||
|
"en_US": "you can either check out the commit directly or simply checkout the tag!"
|
||||||
|
},
|
||||||
|
"startDialog": {
|
||||||
|
"en_US": {
|
||||||
|
"childViews": [
|
||||||
|
{
|
||||||
|
"type": "ModalAlert",
|
||||||
|
"options": {
|
||||||
|
"markdowns": [
|
||||||
|
"## Git Tags",
|
||||||
|
"",
|
||||||
|
"As you have learned from previous lessons, branches are easy to move around and often refer to different commits as work is completed on them. Branches are easily mutated, often temporary, and always changing.",
|
||||||
|
"",
|
||||||
|
"If that's the case, you may be wondering if there's a way to *permanently* mark historical points in your project's history. For things like major releases and big merges, is there any way to mark these commits with something more permanent than a branch?",
|
||||||
|
""
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ModalAlert",
|
||||||
|
"options": {
|
||||||
|
"markdowns": [
|
||||||
|
"You bet there is! Git tags support this exact use case -- they (somewhat) permanently mark certain commits as \"milestones\" that you can then reference like a branch.",
|
||||||
|
"",
|
||||||
|
"More importantly though, they never move as more commits are created. You can't \"check out\" a tag and then complete work on that tag -- tags exist as anchors in the commit tree that designate certain spots.",
|
||||||
|
"",
|
||||||
|
"Let's see what tags look like in practice."
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "GitDemonstrationView",
|
||||||
|
"options": {
|
||||||
|
"beforeMarkdowns": [
|
||||||
|
"Let's try making a tag at `C1` which is our version 1 prototype"
|
||||||
|
],
|
||||||
|
"afterMarkdowns": [
|
||||||
|
"There! Quite easy. We named the tag `v1` and referenced the commit `C1` explicitly. If you leave the commit off, git will just use whatever `HEAD` is at"
|
||||||
|
],
|
||||||
|
"command": "git tag v1 C1",
|
||||||
|
"beforeCommand": "git commit"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ModalAlert",
|
||||||
|
"options": {
|
||||||
|
"markdowns": [
|
||||||
|
"For this level just create the tags in the goal visualization and then check `v1` out. Notice how you go into detached `HEAD` state -- this is because you can't commit directly onto the `v1` tag.",
|
||||||
|
"",
|
||||||
|
"In the next level we'll examine a more interesting use case for tags."
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
Loading…
Add table
Add a link
Reference in a new issue