-
Notifications
You must be signed in to change notification settings - Fork 0
Home
This wiki serves as a space to document my journey in developing various mini projects using JavaScript. Here, I share my learnings, challenges, and solutions.
I forgot to add the HTML file to the first commit of my GuessIndia Game
project. I made two more commits after that. Now I need to fix the first commit by adding the missing file. Here comes the learning about how to go to a particular commit and use branching
, amending
and rebasing
.
-
Creating a Temporary Branch at the commit (a5ed137) where the HTML file was missing.
git checkout -b temp-branch a5ed137
-
After switching to the temporary branch, I added the missing HTML file and amended the commit (created new hash value '9ba86b').
git add misingFile.html git commit --amend
-
Switching Back to Main Branch
git checkout main
-
Rebasing the Main Branch
- I used rebasing to integrate the changes from the temporary branch onto the main branch, starting from the commit '9ba86b':
git rebase --onto temp-branch 9ba86b^ main
-
Deleting the Temporary Branch to keep the repository clean
git branch -d temp-branch
This experience not only helped me recover from a problem but also deepened my understanding of Git's powerful branching and commit management features.