From a629765f46c09cf191c675a6871e4327b7692343 Mon Sep 17 00:00:00 2001 From: bleeptrack Date: Tue, 5 Jan 2021 13:15:05 +0100 Subject: [PATCH] tag levels --- levels/tags/add-tag | 53 +++++++++++++++++++++++++++++++++++ levels/tags/add-tag-later | 50 +++++++++++++++++++++++++++++++++ levels/tags/remote-tag | 58 +++++++++++++++++++++++++++++++++++++++ levels/tags/remove-tag | 53 +++++++++++++++++++++++++++++++++++ 4 files changed, 214 insertions(+) create mode 100644 levels/tags/add-tag create mode 100644 levels/tags/add-tag-later create mode 100644 levels/tags/remote-tag create mode 100644 levels/tags/remove-tag diff --git a/levels/tags/add-tag b/levels/tags/add-tag new file mode 100644 index 0000000..9c5703a --- /dev/null +++ b/levels/tags/add-tag @@ -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 + +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 :) diff --git a/levels/tags/add-tag-later b/levels/tags/add-tag-later new file mode 100644 index 0000000..905647c --- /dev/null +++ b/levels/tags/add-tag-later @@ -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 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 :) diff --git a/levels/tags/remote-tag b/levels/tags/remote-tag new file mode 100644 index 0000000..a484923 --- /dev/null +++ b/levels/tags/remote-tag @@ -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 +Or all tags with: + git push --tags + +Deleting tags on your remote works with: + git push --delete + +You can also sync + git fetch --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)" diff --git a/levels/tags/remove-tag b/levels/tags/remove-tag new file mode 100644 index 0000000..b830b6e --- /dev/null +++ b/levels/tags/remove-tag @@ -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 + +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 :)