From a382c03ccd9f60f1caf59943f25fb4f4aa35ff01 Mon Sep 17 00:00:00 2001 From: Uiyrte Date: Sun, 21 Sep 2025 12:43:41 +0300 Subject: [PATCH 01/12] docs: add PR template --- .github/pull_request_template.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..30a7b22 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,15 @@ +# Pull Request Template + +## Goal + + +## Changes + + +## Testing + + +## Checklist +- [ ] PR has a clear, descriptive title +- [ ] Documentation / README updated if needed +- [ ] No secrets or large temporary files included \ No newline at end of file From d0146fb17393bc2250fd1ca202b2ccd241aedc2e Mon Sep 17 00:00:00 2001 From: Tsimafei Kurstak <63261107+Uiyrte@users.noreply.github.com> Date: Sun, 21 Sep 2025 17:45:28 +0300 Subject: [PATCH 02/12] Create github-actions-demo.yml --- .github/workflows/github-actions-demo.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/github-actions-demo.yml diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml new file mode 100644 index 0000000..b00f8e9 --- /dev/null +++ b/.github/workflows/github-actions-demo.yml @@ -0,0 +1,18 @@ +name: GitHub Actions Demo +run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 +on: [push] +jobs: + Explore-GitHub-Actions: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: Check out repository code + uses: actions/checkout@v5 + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + - name: List files in the repository + run: | + ls ${{ github.workspace }} + - run: echo "🍏 This job's status is ${{ job.status }}." From a0302bb3df9c4809935e08aaf5d56057f49d7631 Mon Sep 17 00:00:00 2001 From: Tsimafei Kurstak <63261107+Uiyrte@users.noreply.github.com> Date: Sun, 21 Sep 2025 22:24:26 +0300 Subject: [PATCH 03/12] Update github-actions-demo.yml --- .github/workflows/github-actions-demo.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml index b00f8e9..4de45c2 100644 --- a/.github/workflows/github-actions-demo.yml +++ b/.github/workflows/github-actions-demo.yml @@ -1,6 +1,8 @@ name: GitHub Actions Demo run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 -on: [push] +on: + workflow_dispatch: + jobs: Explore-GitHub-Actions: runs-on: ubuntu-latest From a41cbefda729f546fe7cd2de14e441185bfe7f1d Mon Sep 17 00:00:00 2001 From: Tsimafei Kurstak <63261107+Uiyrte@users.noreply.github.com> Date: Sun, 21 Sep 2025 22:54:08 +0300 Subject: [PATCH 04/12] Update github-actions-demo.yml --- .github/workflows/github-actions-demo.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml index 4de45c2..ecb0be4 100644 --- a/.github/workflows/github-actions-demo.yml +++ b/.github/workflows/github-actions-demo.yml @@ -18,3 +18,13 @@ jobs: run: | ls ${{ github.workspace }} - run: echo "🍏 This job's status is ${{ job.status }}." + - name: System info + run: | + echo "OS Info" + uname -a + echo "Disk Info" + df + echo "RAM Info" + free + echo "CPU Info" + lscpu From 5f25ef8e0e320381504fbb3c8c2ca97389c24e5e Mon Sep 17 00:00:00 2001 From: Tsimafei Kurstak <63261107+Uiyrte@users.noreply.github.com> Date: Sun, 21 Sep 2025 22:59:41 +0300 Subject: [PATCH 05/12] system info --- .github/workflows/github-actions-demo.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml index ecb0be4..211f63e 100644 --- a/.github/workflows/github-actions-demo.yml +++ b/.github/workflows/github-actions-demo.yml @@ -1,23 +1,13 @@ name: GitHub Actions Demo run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 on: + push: workflow_dispatch: jobs: Explore-GitHub-Actions: runs-on: ubuntu-latest steps: - - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" - - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - - name: Check out repository code - uses: actions/checkout@v5 - - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - - run: echo "🖥️ The workflow is now ready to test your code on the runner." - - name: List files in the repository - run: | - ls ${{ github.workspace }} - - run: echo "🍏 This job's status is ${{ job.status }}." - name: System info run: | echo "OS Info" From 84ad0a1c5478949178c8fadc9f30422370d66cdc Mon Sep 17 00:00:00 2001 From: Uiyrte Date: Sun, 21 Sep 2025 12:41:09 +0300 Subject: [PATCH 06/12] docs: add commit signing summary --- labs/submission1.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 labs/submission1.md diff --git a/labs/submission1.md b/labs/submission1.md new file mode 100644 index 0000000..baec1fe --- /dev/null +++ b/labs/submission1.md @@ -0,0 +1,10 @@ +# Benefits of signing commits + +Signing commits using SSH or GPG provides: + +- Author authentication - confirms that the commit was made by the real owner of the key. +- Data integrity - ensures that the commit has not been modified after creation. +- Anti-forgery protection - eliminates the possibility of falsifying the project history. +- Verified label on GitHub - increases trust in the code and its origin. + +GitHub keeps the signature verification forever, even if the key is later revoked or expires. SSH signature is easier to set up and can use an existing key. \ No newline at end of file From b789fa56b1f66cab4086e1807ea05d3f3eedc5cc Mon Sep 17 00:00:00 2001 From: Uiyrte Date: Sun, 21 Sep 2025 15:38:24 +0300 Subject: [PATCH 07/12] First commit --- file.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 file.txt diff --git a/file.txt b/file.txt new file mode 100644 index 0000000..6eaf244 --- /dev/null +++ b/file.txt @@ -0,0 +1 @@ +First commit From afe1cdd7c094e0cb9887ae2b91fac5cf8f58ddf8 Mon Sep 17 00:00:00 2001 From: Uiyrte Date: Sun, 21 Sep 2025 15:38:24 +0300 Subject: [PATCH 08/12] Second commit --- file.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/file.txt b/file.txt index 6eaf244..6a3adff 100644 --- a/file.txt +++ b/file.txt @@ -1 +1,2 @@ First commit +Second commit From 6312bb1474b90701d7aa77cdc02d97b917eaec0f Mon Sep 17 00:00:00 2001 From: Uiyrte Date: Sun, 21 Sep 2025 16:07:34 +0300 Subject: [PATCH 09/12] Side branch commit --- history.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 history.txt diff --git a/history.txt b/history.txt new file mode 100644 index 0000000..6ff655d --- /dev/null +++ b/history.txt @@ -0,0 +1 @@ +Branch commit From 8430615f247fc03b2d56175a482c405eecd8a77e Mon Sep 17 00:00:00 2001 From: Uiyrte Date: Sun, 21 Sep 2025 16:51:23 +0300 Subject: [PATCH 10/12] docs: add lab2 submission --- labs/submission2.md | 398 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 398 insertions(+) create mode 100644 labs/submission2.md diff --git a/labs/submission2.md b/labs/submission2.md new file mode 100644 index 0000000..cf8c6b2 --- /dev/null +++ b/labs/submission2.md @@ -0,0 +1,398 @@ +# Lab 2 — Version Control & Advanced Git + +## Task 1 — Git Object Model Exploration + +### Blob object + +command: +```bash +git cat-file -p baec1feeded41be2e899a27ec4b00b0b3b466178 +``` + +output: +``` +# Benefits of signing commits + +Signing commits using SSH or GPG provides: + +- Author authentication - confirms that the commit was made by the real owner of the key. +- Data integrity - ensures that the commit has not been modified after creation. +- Anti-forgery protection - eliminates the possibility of falsifying the project history. +- Verified label on GitHub - increases trust in the code and its origin. + +GitHub keeps the signature verification forever, even if the key is later revoked or expires. SSH signature is easier to set up and can use an existing key. +``` + +description: + +A blob object in Git contains the pure contents of a file, without information about its name, location, or permissions. + + + +### Tree object + +command: +```bash +git cat-file -p c9795fb4abcf4af84f78e746b2e047950542518b +``` + +output: + +``` +100644 blob 4db373667a50f14a411bb5c7e879690fd08aacc1 README.md +040000 tree 88a76b098374b9e73193ba154a2402f900561439 labs +040000 tree 2f0387f9eebb6ad846cd02dbd1e7a4a151c06a7e lectures +``` + +description: + +A tree object in Git reflects the structure of a directory, linking file names to corresponding blob objects (file contents) or other trees (subfolders). + + + +### Commit object + +command: +```bash +git cat-file -p 31636fa8b2607ffaa1f46bd490ce093d191a2d6d +``` + +output: + +``` +tree c9795fb4abcf4af84f78e746b2e047950542518b +parent 82d1989821eb80d23d2f29dc297e919f9a0a121b +author Uiyrte 1758447669 +0300 +committer Uiyrte 1758447669 +0300 +gpgsig -----BEGIN SSH SIGNATURE----- + U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAg+baQmrwfNyIlbPwUvrEZ2+FuUj + lhyrjKOyLPdIhUSt4AAAADZ2l0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5 + AAAAQDFhJBgtvoqXmG9exZA/xnbWwoJNSn/fulZ4qWiG6gE2KmrUVGcp+Ia9805FRJFlN8 + HwQ+kl4Ie1pah0MerYjQo= + -----END SSH SIGNATURE----- +``` + +description: + +A Git commit refers to a tree that represents a snapshot of a project and includes metadata such as parent commits, author and committer information, a digital signature, and a commit message. + + + + + +## Task 2 - Reset and Reflog Recovery + + + +Creating and switching to a new branch +```bash +git switch -c git-reset-practice +``` + +Output and save the line to a file, add the contents of the working directory to the index (staging area) for subsequent commit. Write changes to the repository.Repeat 3 times for 3 different commits. +```bash +echo "First commit" > file.txt && git add file.txt && git commit -m "First commit" +echo "Second commit" >> file.txt && git add file.txt && git commit -m "Second commit" +echo "Third commit" >> file.txt && git add file.txt && git commit -m "Third commit" +``` + +Displaying the story in a short, one-line format. +```bash +git log --oneline +``` + +Removing the last commit from the repository. Changes remain indexed and are not removed from staging area. + +```bash +git reset --soft HEAD~1 +git log --oneline +``` + +Removing the last commit from the repository. Resets the indexing and removes it from stagibg area. + +```bash +git reset --hard HEAD~1 +git log --oneline +``` + +Shows the history of changes to the HEAD pointer. + +```bash +git reflog +``` + +Transfer to a commit with a hash without saving changes. + +```bash +git reset --hard a499152 +``` + +After git reflog +``` +28fa0eb (HEAD -> git-reset-practice) HEAD@{0}: reset: moving to HEAD~1 +a499152 HEAD@{1}: reset: moving to HEAD~1 +06f7fac HEAD@{2}: commit: Third commit +a499152 HEAD@{3}: commit: Second commit +``` + + +git log --oneline + +After creating 3 commits +``` +06f7fac (HEAD -> git-reset-practice) Third commit +a499152 Second commit +28fa0eb First commit +``` + +After soft reset +``` +a499152 (HEAD -> git-reset-practice) Second commit +28fa0eb First commit +``` + +After hard reset +``` +28fa0eb (HEAD -> git-reset-practice) First commit +``` + +After reflog reset to a499152 +``` +a499152 (HEAD -> git-reset-practice) Second commit +28fa0eb First commit +``` + + + ###Changes +| Reset Option | File System Snapshot | Staging Area Status | HEAD Position Update | +|----------------------|--------------------------------------|----------------------------------|-------------------------------------------| +| `--soft HEAD~1` | Files remain unchanged | Staged changes are preserved | HEAD moves back by one commit | +| `--hard HEAD@{1}` | Files restored to earlier state | Synced with working directory | HEAD reset to a previous reference point | +| `--hard HEAD~1` | Files revert to the prior commit | Synced with working directory | HEAD moves back by one commit | +| `--hard ` | Files updated to match given commit | Synced with working directory | HEAD set to the specified commit | + + +## Task 3 — Visualize Commit History +### Snippet of the graph + +```bash +* 177621e (git-reset-practice) Side branch commit +| * b829c23 (HEAD -> side-branch) Side branch commit +|/ +* a499152 Second commit +* 28fa0eb First commit +* 31636fa (origin/feature/lab1, feature/lab1) docs: add commit signing summary +| * a382c03 (origin/main, origin/HEAD, main) docs: add PR template +|/ +* 82d1989 feat: publish lab3 and lec3 +* 3f80c83 feat: publish lec2 +* 499f2ba feat: publish lab2 +* af0da89 feat: update lab1 +* 74a8c27 Publish lab1 +* f0485c0 Publish lec1 +* 31dd11b Publish README.md +``` + +### Commit messages list +- Side branch commit +- Second commit +- First commit +- docs: add PR template +- docs: add commit signing summary +- feat: publish lab3 and lec3 +- feat: publish lec2 +- feat: publish lab2 +- feat: update lab1 +- Publish lab1 +- Publish lec1 +- Publish README.md + +### Reflection +The graph visualizes the repository’s branching structure, clearly illustrating where branches split off and how individual commits are connected. +This provides insight into the project's evolution and clarifies how different branches relate to one another. + +## Task 4 — Tagging Commits +# Move to the lab branch +git switch -c feature/lab2 + +# Add a lightweight tag named 'v1.0.0' to the current commit +git tag v1.0.0 + +# Display details of the commit associated with the tag +git show v1.0.0 + +# Upload the tag to the remote repository named 'origin' +git push origin v1.0.0 + + +### Tag Name +Tag: v1.0.0 +- Commit Hash: b829c23c7d330f2044658890e59a73e16d490073 + +### Notes +Tags serve as reference markers for key moments in a project's history, typically used to designate official releases. They play a crucial role in version control, help initiate CI/CD workflows, and assist in producing release notes—providing a reliable pointer to stable or production-ready code. + +## Task 5 — git switch vs git checkout vs git restore +### Branch Switching with `git switch` +Command: +```bash +git switch feature/lab2 +``` +Output: +``` +Already on 'feature/lab2' +Your branch is up to date with 'origin/feature/lab2'. +``` + + +Creating a new branch cmd-compare and switching. +Command: +```bash +git switch -c cmd-compare +``` +Output: +``` +Switched to a new branch 'cmd-compare' +``` + +Switching back to the feature/lab2. + +Command: +```bash +git switch - +``` +Output: +``` +Switched to branch 'feature/lab2' +Your branch is up to date with 'origin/feature/lab2'. +``` + +Command: +```bash +git branch +``` + +Showing all branches and indicates the current branch with *. + +Output: +```bash + cmd-compare + feature/lab1 +* feature/lab2 + git-reset-practice + main + side-branch +``` + + +### Branch Creation with Legacy `git checkout` + +Command: +```bash +git checkout -b cmd-compare-2 +``` + +Creating and switching to a new branch (cmd-compare-2) using the legacy git checkout command + +Output: +``` +Switched to a new branch 'cmd-compare-2' +``` + + +Command: +```bash +git branch +``` +'cmd-compare-2' now is the current brunch + +Output: +```bash + cmd-compare +* cmd-compare-2 + feature/lab1 + feature/lab2 + git-reset-practice + main + side-branch +``` + + + +### Working with Files Using `git restore` +Command: +```bash +echo "scratch" >> demo.txt +git status +git add demo.txt +``` +Save text to the file. Add file to staging. + +Output: +``` +On branch cmd-compare-2 +Untracked files: + (use "git add ..." to include in what will be committed) + demo.txt +``` + + + +Command: +```bash +git restore demo.txt +git status +``` +Discards changes only in the working directory. +Output: +``` +On branch cmd-compare-2 +Changes to be committed: + new file: demo.txt +``` + + + +Command: +```bash +git restore --staged demo.txt +git status +``` + +Removing the file from staging area. +Output: +``` +On branch cmd-compare-2 +Untracked files: + demo.txt +``` + + +Command: +```bash +git add demo.txt +git restore --source=HEAD~1 demo.txt +git status +``` +Output: +``` +On branch cmd-compare-2 +Changes to be committed: + new file: demo.txt +Changes not staged for commit: + deleted: demo.txt +``` + + + +### Summary of Differences +| Command | Description | +|----------------------------------|------------------------------------------------------------------------------| +| `git switch` | Modern command for changing branches or creating new ones. | +| `git checkout -b` | Older method to create and switch branches; also used for file restoration. | +| `git restore ` | Reverts changes in the working directory for tracked files. | +| `git restore --staged ` | Unstages files without modifying their content in the working directory. | +| `git restore --source=` | Retrieves a file from a specific commit; removes it if it didn’t exist then.| + +### Bonus +Stars help highlight valuable projects and make them easier to find. Following contributors fosters collaboration and keeps the team updated on each other's work. \ No newline at end of file From 2642f9e79f77651a63522647ff61d2c9d71d3216 Mon Sep 17 00:00:00 2001 From: Uiyrte Date: Sun, 21 Sep 2025 23:06:56 +0300 Subject: [PATCH 11/12] feature/lab3 --- labs/submission3.md | 86 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 labs/submission3.md diff --git a/labs/submission3.md b/labs/submission3.md new file mode 100644 index 0000000..175cca7 --- /dev/null +++ b/labs/submission3.md @@ -0,0 +1,86 @@ + +## Task 1 + +**Link to a successful run:** + +https://github.com/Uiyrte/F25-DevOps-Intro/actions/runs/17895083050 + + +**Learned key concepts** + + **Workflow** is an automated process described in a YAML file, which is placed in the .github/workflows/. + **Trigger** (on: push) is an event that triggers a workflow. In this case, it is a push commit to a repository branch. + **Job** is a set of steps that are executed on a single runner. The current workflow uses one job called Explore-GitHub-Actions. + **Steps** are sequential actions within a job. They can be either custom commands (run:) or built-in actions (uses:). + **Runner** is a server provided by GitHub, on which jobs are executed. This task uses ubuntu-latest. + + +**What triggered the workflow to run** + +Workflow was activated automatically after a commit with the github-actions-demo.yml file was pushed to the feature/lab3 branch. The push event acted as a trigger that initiated the process execution. + +## Task 2 +**OS Info** +``` +Linux runnervmf4ws1 6.11.0-1018-azure #18~24.04.1-Ubuntu SMP Sat Jun 28 04:46:03 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux +``` +**Disk Info** +``` +Filesystem 1K-blocks Used Available Use% Mounted on +/dev/root 75085112 47591588 27477140 64% / +tmpfs 8189736 84 8189652 1% /dev/shm +tmpfs 3275896 1104 3274792 1% /run +tmpfs 5120 0 5120 0% /run/lock +/dev/sdb16 901520 60640 777752 8% /boot +/dev/sdb15 106832 6250 100582 6% /boot/efi +/dev/sda1 76829444 4194336 68686668 6% /mnt +tmpfs 1637944 12 1637932 1% /run/user/1001 +``` +**RAM Info** +``` + total used free shared buff/cache available +Mem: 16379472 745352 14444848 36172 1530600 15634120 +Swap: 4194300 0 4194300 +``` +**CPU Info** +``` +Architecture: x86_64 +CPU op-mode(s): 32-bit, 64-bit +Address sizes: 48 bits physical, 48 bits virtual +Byte Order: Little Endian +CPU(s): 4 +On-line CPU(s) list: 0-3 +Vendor ID: AuthenticAMD +Model name: AMD EPYC 7763 64-Core Processor +CPU family: 25 +Model: 1 +Thread(s) per core: 2 +Core(s) per socket: 2 +Socket(s): 1 +Stepping: 1 +BogoMIPS: 4890.86 +Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl tsc_reliable nonstop_tsc cpuid extd_apicid aperfmperf tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves user_shstk clzero xsaveerptr rdpru arat npt nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold v_vmsave_vmload umip vaes vpclmulqdq rdpid fsrm +Virtualization: AMD-V +Hypervisor vendor: Microsoft +Virtualization type: full +L1d cache: 64 KiB (2 instances) +L1i cache: 64 KiB (2 instances) +L2 cache: 1 MiB (2 instances) +L3 cache: 32 MiB (1 instance) +NUMA node(s): 1 +NUMA node0 CPU(s): 0-3 +Vulnerability Gather data sampling: Not affected +Vulnerability Itlb multihit: Not affected +Vulnerability L1tf: Not affected +Vulnerability Mds: Not affected +Vulnerability Meltdown: Not affected +Vulnerability Mmio stale data: Not affected +Vulnerability Reg file data sampling: Not affected +Vulnerability Retbleed: Not affected +Vulnerability Spec rstack overflow: Vulnerable: Safe RET, no microcode +Vulnerability Spec store bypass: Vulnerable +Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization +Vulnerability Spectre v2: Mitigation; Retpolines; STIBP disabled; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected +Vulnerability Srbds: Not affected +Vulnerability Tsx async abort: Not affected +``` \ No newline at end of file From 2ebc9b4a4ac654b29fda83474f05c9391e182905 Mon Sep 17 00:00:00 2001 From: Uiyrte Date: Sun, 21 Sep 2025 23:53:03 +0300 Subject: [PATCH 12/12] delete some files --- labs/submission1.md | 10 -- labs/submission2.md | 398 -------------------------------------------- 2 files changed, 408 deletions(-) delete mode 100644 labs/submission1.md delete mode 100644 labs/submission2.md diff --git a/labs/submission1.md b/labs/submission1.md deleted file mode 100644 index baec1fe..0000000 --- a/labs/submission1.md +++ /dev/null @@ -1,10 +0,0 @@ -# Benefits of signing commits - -Signing commits using SSH or GPG provides: - -- Author authentication - confirms that the commit was made by the real owner of the key. -- Data integrity - ensures that the commit has not been modified after creation. -- Anti-forgery protection - eliminates the possibility of falsifying the project history. -- Verified label on GitHub - increases trust in the code and its origin. - -GitHub keeps the signature verification forever, even if the key is later revoked or expires. SSH signature is easier to set up and can use an existing key. \ No newline at end of file diff --git a/labs/submission2.md b/labs/submission2.md deleted file mode 100644 index cf8c6b2..0000000 --- a/labs/submission2.md +++ /dev/null @@ -1,398 +0,0 @@ -# Lab 2 — Version Control & Advanced Git - -## Task 1 — Git Object Model Exploration - -### Blob object - -command: -```bash -git cat-file -p baec1feeded41be2e899a27ec4b00b0b3b466178 -``` - -output: -``` -# Benefits of signing commits - -Signing commits using SSH or GPG provides: - -- Author authentication - confirms that the commit was made by the real owner of the key. -- Data integrity - ensures that the commit has not been modified after creation. -- Anti-forgery protection - eliminates the possibility of falsifying the project history. -- Verified label on GitHub - increases trust in the code and its origin. - -GitHub keeps the signature verification forever, even if the key is later revoked or expires. SSH signature is easier to set up and can use an existing key. -``` - -description: - -A blob object in Git contains the pure contents of a file, without information about its name, location, or permissions. - - - -### Tree object - -command: -```bash -git cat-file -p c9795fb4abcf4af84f78e746b2e047950542518b -``` - -output: - -``` -100644 blob 4db373667a50f14a411bb5c7e879690fd08aacc1 README.md -040000 tree 88a76b098374b9e73193ba154a2402f900561439 labs -040000 tree 2f0387f9eebb6ad846cd02dbd1e7a4a151c06a7e lectures -``` - -description: - -A tree object in Git reflects the structure of a directory, linking file names to corresponding blob objects (file contents) or other trees (subfolders). - - - -### Commit object - -command: -```bash -git cat-file -p 31636fa8b2607ffaa1f46bd490ce093d191a2d6d -``` - -output: - -``` -tree c9795fb4abcf4af84f78e746b2e047950542518b -parent 82d1989821eb80d23d2f29dc297e919f9a0a121b -author Uiyrte 1758447669 +0300 -committer Uiyrte 1758447669 +0300 -gpgsig -----BEGIN SSH SIGNATURE----- - U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAg+baQmrwfNyIlbPwUvrEZ2+FuUj - lhyrjKOyLPdIhUSt4AAAADZ2l0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5 - AAAAQDFhJBgtvoqXmG9exZA/xnbWwoJNSn/fulZ4qWiG6gE2KmrUVGcp+Ia9805FRJFlN8 - HwQ+kl4Ie1pah0MerYjQo= - -----END SSH SIGNATURE----- -``` - -description: - -A Git commit refers to a tree that represents a snapshot of a project and includes metadata such as parent commits, author and committer information, a digital signature, and a commit message. - - - - - -## Task 2 - Reset and Reflog Recovery - - - -Creating and switching to a new branch -```bash -git switch -c git-reset-practice -``` - -Output and save the line to a file, add the contents of the working directory to the index (staging area) for subsequent commit. Write changes to the repository.Repeat 3 times for 3 different commits. -```bash -echo "First commit" > file.txt && git add file.txt && git commit -m "First commit" -echo "Second commit" >> file.txt && git add file.txt && git commit -m "Second commit" -echo "Third commit" >> file.txt && git add file.txt && git commit -m "Third commit" -``` - -Displaying the story in a short, one-line format. -```bash -git log --oneline -``` - -Removing the last commit from the repository. Changes remain indexed and are not removed from staging area. - -```bash -git reset --soft HEAD~1 -git log --oneline -``` - -Removing the last commit from the repository. Resets the indexing and removes it from stagibg area. - -```bash -git reset --hard HEAD~1 -git log --oneline -``` - -Shows the history of changes to the HEAD pointer. - -```bash -git reflog -``` - -Transfer to a commit with a hash without saving changes. - -```bash -git reset --hard a499152 -``` - -After git reflog -``` -28fa0eb (HEAD -> git-reset-practice) HEAD@{0}: reset: moving to HEAD~1 -a499152 HEAD@{1}: reset: moving to HEAD~1 -06f7fac HEAD@{2}: commit: Third commit -a499152 HEAD@{3}: commit: Second commit -``` - - -git log --oneline - -After creating 3 commits -``` -06f7fac (HEAD -> git-reset-practice) Third commit -a499152 Second commit -28fa0eb First commit -``` - -After soft reset -``` -a499152 (HEAD -> git-reset-practice) Second commit -28fa0eb First commit -``` - -After hard reset -``` -28fa0eb (HEAD -> git-reset-practice) First commit -``` - -After reflog reset to a499152 -``` -a499152 (HEAD -> git-reset-practice) Second commit -28fa0eb First commit -``` - - - ###Changes -| Reset Option | File System Snapshot | Staging Area Status | HEAD Position Update | -|----------------------|--------------------------------------|----------------------------------|-------------------------------------------| -| `--soft HEAD~1` | Files remain unchanged | Staged changes are preserved | HEAD moves back by one commit | -| `--hard HEAD@{1}` | Files restored to earlier state | Synced with working directory | HEAD reset to a previous reference point | -| `--hard HEAD~1` | Files revert to the prior commit | Synced with working directory | HEAD moves back by one commit | -| `--hard ` | Files updated to match given commit | Synced with working directory | HEAD set to the specified commit | - - -## Task 3 — Visualize Commit History -### Snippet of the graph - -```bash -* 177621e (git-reset-practice) Side branch commit -| * b829c23 (HEAD -> side-branch) Side branch commit -|/ -* a499152 Second commit -* 28fa0eb First commit -* 31636fa (origin/feature/lab1, feature/lab1) docs: add commit signing summary -| * a382c03 (origin/main, origin/HEAD, main) docs: add PR template -|/ -* 82d1989 feat: publish lab3 and lec3 -* 3f80c83 feat: publish lec2 -* 499f2ba feat: publish lab2 -* af0da89 feat: update lab1 -* 74a8c27 Publish lab1 -* f0485c0 Publish lec1 -* 31dd11b Publish README.md -``` - -### Commit messages list -- Side branch commit -- Second commit -- First commit -- docs: add PR template -- docs: add commit signing summary -- feat: publish lab3 and lec3 -- feat: publish lec2 -- feat: publish lab2 -- feat: update lab1 -- Publish lab1 -- Publish lec1 -- Publish README.md - -### Reflection -The graph visualizes the repository’s branching structure, clearly illustrating where branches split off and how individual commits are connected. -This provides insight into the project's evolution and clarifies how different branches relate to one another. - -## Task 4 — Tagging Commits -# Move to the lab branch -git switch -c feature/lab2 - -# Add a lightweight tag named 'v1.0.0' to the current commit -git tag v1.0.0 - -# Display details of the commit associated with the tag -git show v1.0.0 - -# Upload the tag to the remote repository named 'origin' -git push origin v1.0.0 - - -### Tag Name -Tag: v1.0.0 -- Commit Hash: b829c23c7d330f2044658890e59a73e16d490073 - -### Notes -Tags serve as reference markers for key moments in a project's history, typically used to designate official releases. They play a crucial role in version control, help initiate CI/CD workflows, and assist in producing release notes—providing a reliable pointer to stable or production-ready code. - -## Task 5 — git switch vs git checkout vs git restore -### Branch Switching with `git switch` -Command: -```bash -git switch feature/lab2 -``` -Output: -``` -Already on 'feature/lab2' -Your branch is up to date with 'origin/feature/lab2'. -``` - - -Creating a new branch cmd-compare and switching. -Command: -```bash -git switch -c cmd-compare -``` -Output: -``` -Switched to a new branch 'cmd-compare' -``` - -Switching back to the feature/lab2. - -Command: -```bash -git switch - -``` -Output: -``` -Switched to branch 'feature/lab2' -Your branch is up to date with 'origin/feature/lab2'. -``` - -Command: -```bash -git branch -``` - -Showing all branches and indicates the current branch with *. - -Output: -```bash - cmd-compare - feature/lab1 -* feature/lab2 - git-reset-practice - main - side-branch -``` - - -### Branch Creation with Legacy `git checkout` - -Command: -```bash -git checkout -b cmd-compare-2 -``` - -Creating and switching to a new branch (cmd-compare-2) using the legacy git checkout command - -Output: -``` -Switched to a new branch 'cmd-compare-2' -``` - - -Command: -```bash -git branch -``` -'cmd-compare-2' now is the current brunch - -Output: -```bash - cmd-compare -* cmd-compare-2 - feature/lab1 - feature/lab2 - git-reset-practice - main - side-branch -``` - - - -### Working with Files Using `git restore` -Command: -```bash -echo "scratch" >> demo.txt -git status -git add demo.txt -``` -Save text to the file. Add file to staging. - -Output: -``` -On branch cmd-compare-2 -Untracked files: - (use "git add ..." to include in what will be committed) - demo.txt -``` - - - -Command: -```bash -git restore demo.txt -git status -``` -Discards changes only in the working directory. -Output: -``` -On branch cmd-compare-2 -Changes to be committed: - new file: demo.txt -``` - - - -Command: -```bash -git restore --staged demo.txt -git status -``` - -Removing the file from staging area. -Output: -``` -On branch cmd-compare-2 -Untracked files: - demo.txt -``` - - -Command: -```bash -git add demo.txt -git restore --source=HEAD~1 demo.txt -git status -``` -Output: -``` -On branch cmd-compare-2 -Changes to be committed: - new file: demo.txt -Changes not staged for commit: - deleted: demo.txt -``` - - - -### Summary of Differences -| Command | Description | -|----------------------------------|------------------------------------------------------------------------------| -| `git switch` | Modern command for changing branches or creating new ones. | -| `git checkout -b` | Older method to create and switch branches; also used for file restoration. | -| `git restore ` | Reverts changes in the working directory for tracked files. | -| `git restore --staged ` | Unstages files without modifying their content in the working directory. | -| `git restore --source=` | Retrieves a file from a specific commit; removes it if it didn’t exist then.| - -### Bonus -Stars help highlight valuable projects and make them easier to find. Following contributors fosters collaboration and keeps the team updated on each other's work. \ No newline at end of file