Skip to content
Rahul Kumar edited this page Nov 4, 2024 · 1 revision

Welcome to the js-mini-projects wiki!

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.

Learnt something interesting today

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.

Key Learnings

Git Commands Used

  1. Creating a Temporary Branch at the commit (a5ed137) where the HTML file was missing.

    git checkout -b temp-branch a5ed137
    
  2. 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
    
  3. Switching Back to Main Branch

    git checkout main
    
  4. 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
    
  5. Deleting the Temporary Branch to keep the repository clean

    git branch -d temp-branch
    

Conclusion

This experience not only helped me recover from a problem but also deepened my understanding of Git's powerful branching and commit management features.