DevOps Classroom notes 17/Nov/2023

Rewriting History – Changing the already existing commits

Changing latest commit message

  • We have created a commit
  • Commit message has a typo
  • we need to change the commit message

Changing the older commit message

  • We have the following commits
  • We need to change the commit message of 594526a to “Added 4.txt”
  • we need to rewrite from one position behind head HEAD~1
  • When using interactive rebase use HEAD~1+1
  • In this we need to reword since we need to change the commit message.

Other scenarios

  • Refer classroom video for
    • deleting commits
    • combining commits

Git reflog

  • Refer Here for official docs
  • Git reflog is like a permanent log of local git repo
  • Now using reflogs we can undo certain stuff
  • Exercise:

    • Create 5 commits assuming 5 is latest commit
    • Delete commit 4 and try to recover using reflog.
  • Try now

Waiting till 9:15 AM

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner