mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-20 16:20:18 +01:00
tag levels
This commit is contained in:
parent
21d8366dbb
commit
a629765f46
4 changed files with 214 additions and 0 deletions
53
levels/tags/add-tag
Normal file
53
levels/tags/add-tag
Normal file
|
@ -0,0 +1,53 @@
|
|||
title = Creating tags
|
||||
cards = checkout commit-auto merge reset-hard
|
||||
|
||||
[description]
|
||||
|
||||
Some of your commits may be special commits. Maybe you reached a milestone or a new version number.
|
||||
|
||||
You can mark these commits with a special flag called 'tag'.
|
||||
|
||||
Write
|
||||
|
||||
git tag <tag-name>
|
||||
|
||||
to tag your commit.
|
||||
|
||||
---
|
||||
tipp1
|
||||
---
|
||||
tipp2
|
||||
---
|
||||
tipp3
|
||||
|
||||
[setup]
|
||||
|
||||
echo "event 1" > feature-list
|
||||
|
||||
git add .
|
||||
git commit -m "Adding feature 1"
|
||||
|
||||
echo "event 2" >> feature-list
|
||||
|
||||
git add .
|
||||
git commit -m "Adding feature 2"
|
||||
|
||||
echo "event 3" >> feature-list
|
||||
|
||||
git add .
|
||||
git commit -m "Adding feature 3"
|
||||
|
||||
git checkout --detach main
|
||||
|
||||
[win]
|
||||
|
||||
# Did you create a new tag?
|
||||
test "$(git tag -l | wc -l)" -ge 1
|
||||
|
||||
[actions]
|
||||
|
||||
|
||||
|
||||
[congrats]
|
||||
|
||||
Nice! You tagged your first commit :)
|
50
levels/tags/add-tag-later
Normal file
50
levels/tags/add-tag-later
Normal file
|
@ -0,0 +1,50 @@
|
|||
title = Tagging later
|
||||
cards = checkout commit-auto merge reset-hard
|
||||
|
||||
[description]
|
||||
|
||||
But what happens if you forgot to tag your current commit?
|
||||
No Prob! You can also tag older commits via
|
||||
|
||||
git tag <tag-name> <commit-hash>
|
||||
|
||||
Tag the commit "Adding feature 2" with the name "v1"!
|
||||
|
||||
---
|
||||
tipp1
|
||||
---
|
||||
tipp2
|
||||
---
|
||||
tipp3
|
||||
|
||||
[setup]
|
||||
|
||||
echo "event 1" > feature-list
|
||||
|
||||
git add .
|
||||
git commit -m "Adding feature 1"
|
||||
|
||||
echo "event 2" >> feature-list
|
||||
|
||||
git add .
|
||||
git commit -m "Adding feature 2"
|
||||
|
||||
echo "event 3" >> feature-list
|
||||
|
||||
git add .
|
||||
git commit -m "Adding feature 3"
|
||||
|
||||
git checkout --detach main
|
||||
|
||||
[win]
|
||||
|
||||
# Did you create a new tag?
|
||||
test "$(git show v1 -s --format=%h)" = "$(git show HEAD~1 -s --format=%h)"
|
||||
|
||||
[actions]
|
||||
|
||||
|
||||
|
||||
[congrats]
|
||||
|
||||
Well done :)
|
58
levels/tags/remote-tag
Normal file
58
levels/tags/remote-tag
Normal file
|
@ -0,0 +1,58 @@
|
|||
title = Remote Tags
|
||||
cards = pull push commit-auto checkout
|
||||
|
||||
[description]
|
||||
|
||||
When you work with remote repositories, tags are not pushed or pulled automatically.
|
||||
|
||||
You can push a tag with
|
||||
git push <remote> <tag-name>
|
||||
Or all tags with:
|
||||
git push <remote> --tags
|
||||
|
||||
Deleting tags on your remote works with:
|
||||
git push <remote> --delete <tag-name>
|
||||
|
||||
You can also sync
|
||||
git fetch <remote> --prune --prune-tags
|
||||
|
||||
|
||||
Add a tag names "v2" to the last commit and push it to the remote. Also pull the v1 tag to your local repository.
|
||||
[setup yours]
|
||||
|
||||
git checkout main
|
||||
|
||||
git checkout main
|
||||
echo "toothbrush sharing" > project-ideas
|
||||
git add .
|
||||
git commit -m "First idea"
|
||||
|
||||
echo "Is my phone upside down? App" >> project-ideas
|
||||
git commit -am "Another idea"
|
||||
|
||||
|
||||
|
||||
git push friend main
|
||||
|
||||
git branch -u friend/main main
|
||||
|
||||
[setup friend]
|
||||
|
||||
|
||||
|
||||
[actions friend]
|
||||
|
||||
git tag v1 HEAD~1
|
||||
|
||||
[win]
|
||||
# v1 tag in your repo
|
||||
test "$(git show v1 -s --format=%h)" = "$(git show HEAD~1 -s --format=%h)"
|
||||
|
||||
# v2 tag in your repo
|
||||
test "$(git show v2 -s --format=%h)" = "$(git show HEAD -s --format=%h)"
|
||||
|
||||
|
||||
[win friend]
|
||||
|
||||
# v2 tag in the remote
|
||||
test "$(git show v2 -s --format=%h)" = "$(git show HEAD -s --format=%h)"
|
53
levels/tags/remove-tag
Normal file
53
levels/tags/remove-tag
Normal file
|
@ -0,0 +1,53 @@
|
|||
title = Removing tags
|
||||
cards = checkout commit-auto merge reset-hard
|
||||
|
||||
[description]
|
||||
|
||||
You added way too many tags? No prob! Delete them with
|
||||
|
||||
git tag -d <tag-name>
|
||||
|
||||
Remove all tags in this repo!
|
||||
|
||||
---
|
||||
tipp1
|
||||
---
|
||||
tipp2
|
||||
---
|
||||
tipp3
|
||||
|
||||
[setup]
|
||||
|
||||
echo "event 1" > feature-list
|
||||
|
||||
git add .
|
||||
git commit -m "Adding feature 1"
|
||||
|
||||
echo "event 2" >> feature-list
|
||||
|
||||
git add .
|
||||
git commit -m "Adding feature 2"
|
||||
|
||||
echo "event 3" >> feature-list
|
||||
|
||||
git add .
|
||||
git commit -m "Adding feature 3"
|
||||
|
||||
git tag v1 HEAD~2
|
||||
git tag v2 HEAD~1
|
||||
git tag v3
|
||||
|
||||
git checkout --detach main
|
||||
|
||||
[win]
|
||||
|
||||
# Did you create a new tag?
|
||||
test "$(git tag -l | wc -l)" -eq 0
|
||||
|
||||
[actions]
|
||||
|
||||
|
||||
|
||||
[congrats]
|
||||
|
||||
Well done :)
|
Loading…
Reference in a new issue