diff --git a/levels/00-empty/description b/levels/00-empty/description new file mode 100644 index 0000000..0e18f97 --- /dev/null +++ b/levels/00-empty/description @@ -0,0 +1 @@ +This is an empty level without any winning condition - you can use it as a playground! diff --git a/levels/05-ref/description b/levels/05-ref/description new file mode 100644 index 0000000..097ae6b --- /dev/null +++ b/levels/05-ref/description @@ -0,0 +1,9 @@ +Let's take a look at "refs", short for "references"! Refs are not objects, but rather very simple *pointers* to objects! They can help you keep track of what's where. + +You can create or update a ref with + + git update-ref refs/ + +Make sure to start a ref's name with "refs/"! That's a convention that helps Git find all refs you create. + +Create refs that point to all objects in this repository! diff --git a/levels/05-ref/start b/levels/05-ref/start new file mode 100644 index 0000000..1c9caca --- /dev/null +++ b/levels/05-ref/start @@ -0,0 +1,5 @@ +echo hello > hello +echo world > world +git add . +TREE=$(git write-tree) +git commit-tree $TREE -m "Initial commit" diff --git a/levels/05-ref/win b/levels/05-ref/win new file mode 100644 index 0000000..76a1f24 --- /dev/null +++ b/levels/05-ref/win @@ -0,0 +1,3 @@ +OBJECTS=$(git cat-file --batch-check='%(objectname)' --batch-all-objects | sort) +REF_TARGETS=$(git show-ref -s | sort | uniq) +test "$OBJECTS" = "$REF_TARGETS" diff --git a/levels/06-symref/description b/levels/06-symref/description new file mode 100644 index 0000000..41eedd3 --- /dev/null +++ b/levels/06-symref/description @@ -0,0 +1,9 @@ +Instead of pointing directly to objects, refs can also point to other refs! + +When that happens, they are called "symbolic refs". You can create or update a symbolic ref using + + git symbolic-ref + +Usually, you will only encounter a special symbolic ref called "HEAD". This ref is special in that it doesn't start with "refs/"! + +Try pointing HEAD to the refs in this repository! diff --git a/levels/06-symref/start b/levels/06-symref/start new file mode 100644 index 0000000..d1373ab --- /dev/null +++ b/levels/06-symref/start @@ -0,0 +1,4 @@ +TREE=$(git write-tree) +COMMIT=$(git commit-tree $TREE -m "Initial commit") +git update-ref refs/best_commit $COMMIT +git update-ref refs/worst_commit $COMMIT diff --git a/levels/06-symref/win b/levels/06-symref/win new file mode 100644 index 0000000..2dab745 --- /dev/null +++ b/levels/06-symref/win @@ -0,0 +1 @@ +git symbolic-ref HEAD | grep _commit