merged exercises agian

This commit is contained in:
كارل مبارك 2026-01-15 14:09:38 +01:00
parent 2b01b96881
commit 917933adfd
3 changed files with 153 additions and 123 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -540,109 +540,6 @@ Command: git checkout (timetravel)
See your working tree as it would have been at a specific commit on the timeline.
----
Command: git clone
==================
Clone (copy) a repository in the current folder. First, ``cd`` to a logical location in your computer, then:
.. code-block:: bash
git clone https://git.hackersanddesigners.nl/hrk/braids
That will checkout the repo into a directory ``/braids``, go into this new directory with:
.. code-block:: bash
cd braids
You have now downloaded a repo from the web, complete with the full commit history and all changes.
----
Command: git branch
===================
Choose a slug: lowercase, no spaces. This can be your name or an alias. Example: change ``braids/<your-slug>`` in the command below to ``braids/alex``. From here on out replace <your-slug> with your chosen name!
List branches:
.. code-block:: bash
git branch
Create a branch:
.. code-block:: bash
git branch braids/<your-slug>
Switch to branch:
.. code-block:: bash
git checkout braids/<your-slug>
Shortcut (create + switch):
.. code-block:: bash
git checkout -b braids/<your-slug>
.. note::
Branches are parallel dossiers: safe space for changes.
Make edits here as you wish then stage and commit them.
----
Command: git push
=================
Push your commits to the server, defining the remote branch to track (setting the upstream)
.. code-block:: bash
git push -u origin <your-slug>
This pushes your branch to the 'origin' server.
From then on, unless the remote/branch is named, git push will go in that direction.
.. code-block:: bash
git push
.. note::
disabled push rights for now, only for demonstration purposes, will fail
----
Command: git pull
=================
.. note::
before we do this, one of us changes the background colour and pushes
Pull updates from server:
.. code-block:: bash
git pull
.. note::
During the exercise you mostly push your branch.
Pull is mainly for getting new changes on main (if needed).
fact: git pull is actually a git fetch && git merge
----
Forgejo: what we use today
@ -699,25 +596,76 @@ clone -> branch -> edit -> status -> add -> commit -> push -> view -> iterate
----
Exercise: step 1 (clone & branch)
=================================
----
Command: git clone
==================
Clone (copy) a repository in the current folder. First, ``cd`` to a logical location in your computer, then:
.. code-block:: bash
git clone https://git.hackersanddesigners.nl/hrk/braids
That will checkout the repo into a directory ``/braids``, go into this new directory with:
.. code-block:: bash
cd braids
You have now downloaded a repo from the web, complete with the full commit history and all changes.
----
Command: git branch
===================
Choose a slug: lowercase, no spaces. This can be your name or an alias. Example: change ``braids/<your-slug>`` in the command below to ``braids/alex``. From here on out replace <your-slug> with your chosen name!
List branches:
.. code-block:: bash
git branch
Create a branch:
.. code-block:: bash
git branch braids/<your-slug>
Switch to branch:
.. code-block:: bash
git checkout braids/<your-slug>
Shortcut (create + switch):
.. code-block:: bash
git checkout -b braids/<your-slug>
If everything went well in your initial clone & branch, check the repo with:
If everything went well, check the repo with:
.. code-block:: bash
git status
git branch
The first time you checkout from https://git.hackersanddesigners.nl the server will ask you for credentials. These will be remembered, so only once.
.. note::
Branches are parallel dossiers: safe space for changes.
----
Exercise: step 2 (edit the page)
Edit the page
================================
Edit the root `index.html` (and optionally `style.css`, `assets/`).
Edit the root `index.html` (and optionally add `style.css`, `assets/`).
Make a visible change first:
@ -730,9 +678,11 @@ Then check changes:
git diff
git status
----
Exercise: step 3 (stage + commit)
Stage & commit your changes
=================================
.. code-block:: bash
@ -753,8 +703,12 @@ If you added assets:
----
Exercise: step 4 (push your branch)
===================================
Push your banch
=================
Push your commits to the server, defining a remote branch to track. This is called setting the upstream.
.. code-block:: bash
@ -762,11 +716,22 @@ Exercise: step 4 (push your branch)
(Again, change <your-slug>!)
If prompted for credentials, use your Forgejo login method.
The first time you checkout from https://git.hackersanddesigners.nl the server will ask you for credentials. These will be remembered, so only once.
This pushes your branch to the 'origin' server.
----
From then on, unless the remote/branch is named, ``git push`` will go in that direction.
Exercise: step 5 (view live)
.. code-block:: bash
git push
.. note::
disabled push rights for now, only for demonstration purposes, will fail
View ive!
============================
Open the gallery:
@ -781,8 +746,11 @@ Iterate:
edit -> status -> add -> commit -> push -> refresh
----
Common problems (fast fixes)
============================
@ -829,6 +797,27 @@ Better:
Rule: message should still make sense in 6 months.
----
Optional: git pull
=================
If you want to collaborate with others on the same branch, pull updates from server:
.. code-block:: bash
git pull
.. note::
During the exercise you mostly push your branch.
Pull is mainly for getting new changes on main (if needed).
fact: git pull is actually a git fetch && git merge
----
Optional: git merge