From 5aba2dd71b26f0e03fc4dd7ade7a399a0ac36c59 Mon Sep 17 00:00:00 2001 From: Magdel Date: Mon, 1 Sep 2025 19:10:39 +0000 Subject: [PATCH] Update GIT_ASSIGNMENT.md --- GIT_ASSIGNMENT.md | 106 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/GIT_ASSIGNMENT.md b/GIT_ASSIGNMENT.md index 8396b52..9b4e2c6 100644 --- a/GIT_ASSIGNMENT.md +++ b/GIT_ASSIGNMENT.md @@ -453,6 +453,112 @@ origin https://git.comorin.co/Git-Training-Hub/git-practice-Mag.git (push) ``` +# 10. Pushing & Pulling Changes + +Assignment: + + Push local commits to Git Comorin: + + git push -u origin main + +Edit a file directly on Git Comorin and commit it there. + +In your local repo, run: + +git pull origin main + + Verify that the local file updates. + +### My work +``` +Magdel@LAPTOP-NS5FVUS9 MINGW64 ~/cloned-repo (main) +$ git push -u origin main +``` + +#### Result +Directed to a web page + + +#### My Work and Result +``` +Magdel@LAPTOP-NS5FVUS9 MINGW64 ~/cloned-repo (main) +$ git pull origin main +remote: Enumerating objects: 5, done. +remote: Counting objects: 100% (5/5), done. +remote: Compressing objects: 100% (3/3), done. +remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 (from 0) +Unpacking objects: 100% (3/3), 830 bytes | 138.00 KiB/s, done. +From https://git.comorin.co/Git-Training-Hub/git-practice-Mag + * branch main -> FETCH_HEAD + e6d6844..0d3a053 main -> origin/main +Updating e6d6844..0d3a053 +Fast-forward + GIT_ASSIGNMENT.md | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 61 insertions(+) + ``` + + +# 11. Ignoring Files with .gitignore + +Assignment: + + In your repo, create a file secret.txt. + + Create .gitignore and add: + + secret.txt + +Run git status → confirm secret.txt is ignored. + +Commit the .gitignore file. + +### My work +``` +echo > secret.txt +touch .gitignore +echo "secret.txt" >> .gitignore + +git status +``` + +#### My result +``` +$ git status +On branch main +Your branch is up to date with 'origin/main'. + +Untracked files: + (use "git add ..." to include in what will be committed) + .gitignore + +nothing added to commit but untracked files present (use "git add" to track) +``` + +### My Work +``` +git add .gitignore +git commit -m "To ignore secret.txt" +``` + +#### My Result +``` +Magdel@LAPTOP-NS5FVUS9 MINGW64 ~/cloned-repo (main) +$ git add .gitignore +warning: in the working copy of '.gitignore', LF will be replaced by CRLF the next time Git touches it + +Magdel@LAPTOP-NS5FVUS9 MINGW64 ~/cloned-repo (main) +$ git commit -m "To ignore secret.txt" +[main e67a990] To ignore secret.txt + 1 file changed, 1 insertion(+) + create mode 100644 .gitignore + +``` + + + + + +