Starting an activity
Overview
Each activity can be performed in an isolated folder created by running a simple script.
The script will:
- Create a working directory in the playground folder;
- Set up this folder as a simple Git repository with usage code.
This will allow you to go into this folder and play with a local repository without risk.
Each folder is not designed to last. Consider them as a temporary, throwaway, sandbox where you are free to experiment and fail.
Note
The course repository ignores on purpose whatever is stored in the playgrounds folder.
This enables the creation of local repositories used in each activity.
Those are not considered by Git as submodules! They are just ignored.
Create your activity playground
To create an activity, you just need to run the following command:
sh
./scripts/create-playground.sh {ACTIVITY}Where {ACTIVITY} is the name provided in the activity section.
Example:
bash
./scripts/create-playground.sh rebase-int_dropconsole
---[ CREATING PLAYGROUND ]
Activity: rebase-int_drop
Example project: queue_example
Playground path: /Users/sylvain/dev/lab/git-tutorials/playgrounds/rebase-int_drop
[001] Created playground folder
Initialized empty Git repository in /Users/sylvain/dev/lab/git-tutorials/playgrounds/rebase-int_drop/.git/
[002] Git repository created
Applying: create file with draft specifications
.git/rebase-apply/patch:13: trailing whitespace.
.git/rebase-apply/patch:15: trailing whitespace.
.git/rebase-apply/patch:20: trailing whitespace.
warning: 3 lines add whitespace errors.
applying to an empty history
Applying: api use example for `enqueue()`
Applying: api use example for `dequeue()`
Applying: class skeleton
Applying: add more tests for `dequeue()`
Applying: add constructor and inner collection
Applying: add test for dequeue on empty queue
Applying: add test for queue size
Applying: implement enqueue
Applying: implement dequeue
Applying: implement size
Applying: add debug to enqueue/dequeue
Applying: fix bug
[003] Git history ready
---[ Playground Git history ]
03c2212 (HEAD -> main) fix bug
e2b162f add debug to enqueue/dequeue
f077e13 implement size
3914c29 implement dequeue
337387e implement enqueue
3243c33 add test for queue size
3288d6a add test for dequeue on empty queue
4444848 add constructor and inner collection
f6b3a7b add more tests for `dequeue()`
705e072 class skeleton
c6b14ef api use example for `dequeue()`
f1abcc6 api use example for `enqueue()`
4de9bf7 create file with draft specifications
---[ DONE ]Key takeaway
- Activities are executed in small, temporary repositories created when needed by a simple script.
- When you are asked to run the script
scripts/create-playground.sh, the course assumes that you are located in the course repository root folder. - All activity playgrounds will be stored in your "playgrounds" folder.
- If you ever screw up on a given activity, just delete the playground folder and restart from scratch.