From 65b397cced085247a769470bb3b676197b8cadf6 Mon Sep 17 00:00:00 2001 From: Ashutosh kumar singh Date: Sun, 15 Mar 2026 01:54:04 +0530 Subject: [PATCH 1/4] docs: 13 git exercise writeups --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..f27520f --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# Kabir Git Assignment - 13/13 Exercises +Writeups: master→fix-old-typo solved +SSH PR: [link] +now for the question part + +1. just used start master and then git verify +2. added A.text in stage area then commited it +3. removed one file from stage area then commited the remaining one +4. .gitignore with *.exe etc. +5. used git merge +6. first merged to see the conflict then remove the error then commited the file +7. used stash then remove the bug through editing the file then stash pop the added the line given and finally commited +8. used rebase +9. removed the file then committed the file +10. used mv to change the file name then commited the file +11. edited the file the commited via amend and proper commit message +12. used --date in commit +13. rebased 2 steps back then edited the file then resolved the conflict which arised after rebase after that finally commited the file From bc76b3c68110267c93e04f6d94cdec1d1f6bf6c6 Mon Sep 17 00:00:00 2001 From: Ashutosh Kumar Singh Date: Sun, 15 Mar 2026 13:56:50 +0530 Subject: [PATCH 2/4] Enhance Gitwriteups Updated Gitwriteups with detailed commands and explanations for Git exercises. --- Gitwriteups.md | 38 ++++++++++++++++++++++++++++++++++++++ README.md | 18 ------------------ 2 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 Gitwriteups.md delete mode 100644 README.md diff --git a/Gitwriteups.md b/Gitwriteups.md new file mode 100644 index 0000000..8c17a81 --- /dev/null +++ b/Gitwriteups.md @@ -0,0 +1,38 @@ +# Kabir Git Assignment - 13/13 Exercises +Writeups: master→fix-old-typo solved + +Used this Commands for cloning in the gitbash to solve the Exercise ⬇️ +git clone https://gitexercises.fracz.com/git/exercises.git +cd exercises +git config user.name "Ashutosh kumar singh" +git config user.email "idfor2025@gmail.com" +./configure.sh +git start + + + +1. just used git start master and then git verify + +2. used git A.text to add in stage area then commited it using git commit -m "solved hai" + +3. removed one file using git reset A.txt then commited the remaining one using git commit -m "solved" + +4. .gitignore created using touch .gitignore and then added instruction *.exe , *.o , *.jar , libraries/ then commited the file + +5. used git merge escaped + +6. first used git merge another-piece-of-work to see the conflict then remove the error using vim equation.txt then commited the file + +7. git stash then remove the bug through vim file.txt then file then git stash pop and again the added the line given and finally commited + +8. used git rebase hot-bugfix + +9. git rm --cached ignored.txt to remove then git commit -am "Removed" + +10. git mv File.txt file.txt to change file name then commited the file + +11. vim file.txt to fix the typo then git commit -a --amend and proper commit message + +12. used git commit --amend --no-edit --date to set the requirement + +13. git rebase -i HEAD~2 then vim file.txt to edit the file then resolved the conflict which arised after git rebase --continue after that finally commited the file diff --git a/README.md b/README.md deleted file mode 100644 index f27520f..0000000 --- a/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Kabir Git Assignment - 13/13 Exercises -Writeups: master→fix-old-typo solved -SSH PR: [link] -now for the question part - -1. just used start master and then git verify -2. added A.text in stage area then commited it -3. removed one file from stage area then commited the remaining one -4. .gitignore with *.exe etc. -5. used git merge -6. first merged to see the conflict then remove the error then commited the file -7. used stash then remove the bug through editing the file then stash pop the added the line given and finally commited -8. used rebase -9. removed the file then committed the file -10. used mv to change the file name then commited the file -11. edited the file the commited via amend and proper commit message -12. used --date in commit -13. rebased 2 steps back then edited the file then resolved the conflict which arised after rebase after that finally commited the file From ba112fcae6c07442b619b907a2b54f299ad293b8 Mon Sep 17 00:00:00 2001 From: Ashutosh Kumar Singh Date: Sun, 15 Mar 2026 19:04:26 +0530 Subject: [PATCH 3/4] Revised Gitwriteups Updated the Git writeup with detailed commands and explanations for various Git exercises, including fixing typos, handling merges, and using rebase. --- Gitwriteups.md | 93 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 78 insertions(+), 15 deletions(-) diff --git a/Gitwriteups.md b/Gitwriteups.md index 8c17a81..f7184f6 100644 --- a/Gitwriteups.md +++ b/Gitwriteups.md @@ -1,7 +1,8 @@ # Kabir Git Assignment - 13/13 Exercises -Writeups: master→fix-old-typo solved -Used this Commands for cloning in the gitbash to solve the Exercise ⬇️ + +Setup Commands: + git clone https://gitexercises.fracz.com/git/exercises.git cd exercises git config user.name "Ashutosh kumar singh" @@ -10,29 +11,91 @@ git config user.email "idfor2025@gmail.com" git start + 1. master + Command : "git start master" → "git verify" + + Started on master branch, nothing to change. Just verified it directly. The point was to confirm the starting state is fine as it is. + + + + 2. commit-one-file +Commands: "git add A.txt" → "git commit -m "solved hai" + +Had two files but only needed to stage and commit one. Used "git add" specifically for A.txt so the other file stays untracked. + + + + 3. commit-one-file-staged +Commands:" git reset A.txt " → "git commit -m "solved" " + +Both files were already staged. Used " git reset" to unstage A.txt, then committed only what was left. Reset here doesn't delete anything, just removes from staging area. + + + + 4. ignore-them +Commands: "touch .gitignore" → added `*.exe`, `*.o`, `*.jar`, `libraries/` → `git commit` + +Created a .gitignore file and wrote rules to ignore compiled files and the libraries folder. Git reads this file automatically and skips anything matching those patterns. + + + + 5. chase-branch +Commands: "git merge escaped " + +The branch `escaped` had commits that master was missing. One merge command brought all those commits into the current branch and fast-forwarded to it. + + + + 6. merge-conflict +Commands: "git merge another-piece-of-work" → `vim equation.txt` → `git commit` + +Merging caused a conflict in equation.txt because both branches changed the same line differently. Opened the file in vim, removed the conflict markers, kept the correct version, then committed to finish the merge. + + + + 7. save-your-work +Commands: "git stash" → `vim file.txt` (remove bug) → `git stash pop` → added required line → `git commit` + +Had uncommitted work but needed to fix a bug first without losing it. Stashed the work to clean the working directory, fixed the bug, then popped the stash back to restore the original changes and committed everything. + + + + 8. change-branch-history +Commands: "git rebase hot-bugfix" + +Needed the current branch to start from hot-bugfix instead of where it originally branched off. Rebase replays the commits on top of the new base, making the history look like it always came from there. + + + + 9. remove-ignored-file +Commands: `git rm --cached ignored.txt` → `git commit -am "Removed"` + +The file was already being tracked even though it should have been ignored. `--cached` removes it from tracking without deleting it from disk, then committed to make that removal official. + + + + 10. case-sensitive-filename +Commands: `git mv File.txt file.txt` → `git commit` -1. just used git start master and then git verify +Just renaming the file through the OS wouldn't work because Git (especially on Windows/Mac) might not detect the case change. Using `git mv` forces Git to register it as a rename properly. -2. used git A.text to add in stage area then commited it using git commit -m "solved hai" -3. removed one file using git reset A.txt then commited the remaining one using git commit -m "solved" -4. .gitignore created using touch .gitignore and then added instruction *.exe , *.o , *.jar , libraries/ then commited the file + 11. fix-typo +Commands: `vim file.txt` (fix typo) → `git commit -a --amend` -5. used git merge escaped +Fixed the typo in the file then used `--amend` to update the last commit instead of making a new one. Also changed the commit message to something proper at the same time. -6. first used git merge another-piece-of-work to see the conflict then remove the error using vim equation.txt then commited the file -7. git stash then remove the bug through vim file.txt then file then git stash pop and again the added the line given and finally commited -8. used git rebase hot-bugfix + 12. forge-date +Commands: `git commit --amend --no-edit --date=""` -9. git rm --cached ignored.txt to remove then git commit -am "Removed" +Used `--amend` with `--date` flag to change the timestamp on the last commit. `--no-edit` kept the message same, only the date got updated. -10. git mv File.txt file.txt to change file name then commited the file -11. vim file.txt to fix the typo then git commit -a --amend and proper commit message -12. used git commit --amend --no-edit --date to set the requirement +13. fix-old-typo +Commands: `git rebase -i HEAD~2` → `vim file.txt` → resolved conflict → `git rebase --continue` → commit -13. git rebase -i HEAD~2 then vim file.txt to edit the file then resolved the conflict which arised after git rebase --continue after that finally commited the file +Needed to go back and fix a typo in an older commit, not the latest one. Used interactive rebase to edit that specific commit, fixed the file, then a conflict came up when continuing — resolved it manually and let the rebase finish. From d0b2dead1db5d1654724aa70bf5aa3aa15ae5735 Mon Sep 17 00:00:00 2001 From: Ashutosh Kumar Singh Date: Mon, 16 Mar 2026 11:02:16 +0530 Subject: [PATCH 4/4] Formatted commands Updated command formatting in Gitwriteups.md to use backticks for code snippets. --- Gitwriteups.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Gitwriteups.md b/Gitwriteups.md index f7184f6..6612b3b 100644 --- a/Gitwriteups.md +++ b/Gitwriteups.md @@ -12,56 +12,56 @@ git start 1. master - Command : "git start master" → "git verify" + Command : `git start master` → `git verify` Started on master branch, nothing to change. Just verified it directly. The point was to confirm the starting state is fine as it is. 2. commit-one-file -Commands: "git add A.txt" → "git commit -m "solved hai" +Commands: `git add A.txt` → `git commit -m "solved hai"` Had two files but only needed to stage and commit one. Used "git add" specifically for A.txt so the other file stays untracked. 3. commit-one-file-staged -Commands:" git reset A.txt " → "git commit -m "solved" " +Commands:` git reset A.txt ` → `git commit -m "solved" ` Both files were already staged. Used " git reset" to unstage A.txt, then committed only what was left. Reset here doesn't delete anything, just removes from staging area. 4. ignore-them -Commands: "touch .gitignore" → added `*.exe`, `*.o`, `*.jar`, `libraries/` → `git commit` +Commands: `touch .gitignore` → added `*.exe`, `*.o`, `*.jar`, `libraries/` → `git commit` Created a .gitignore file and wrote rules to ignore compiled files and the libraries folder. Git reads this file automatically and skips anything matching those patterns. 5. chase-branch -Commands: "git merge escaped " +Commands: `git merge escaped ` The branch `escaped` had commits that master was missing. One merge command brought all those commits into the current branch and fast-forwarded to it. 6. merge-conflict -Commands: "git merge another-piece-of-work" → `vim equation.txt` → `git commit` +Commands: `git merge another-piece-of-work` → `vim equation.txt` → `git commit` Merging caused a conflict in equation.txt because both branches changed the same line differently. Opened the file in vim, removed the conflict markers, kept the correct version, then committed to finish the merge. 7. save-your-work -Commands: "git stash" → `vim file.txt` (remove bug) → `git stash pop` → added required line → `git commit` +Commands: `git stash` → `vim file.txt` (remove bug) → `git stash pop` → added required line → `git commit` Had uncommitted work but needed to fix a bug first without losing it. Stashed the work to clean the working directory, fixed the bug, then popped the stash back to restore the original changes and committed everything. 8. change-branch-history -Commands: "git rebase hot-bugfix" +Commands: `git rebase hot-bugfix` Needed the current branch to start from hot-bugfix instead of where it originally branched off. Rebase replays the commits on top of the new base, making the history look like it always came from there.