Did you commit in the wrong branch?

Hey fellas,

Have you encountered some situation where you did git commit on the wrong branch and now thinking to revert it back and commit in the new branch. Stop worrying about that. Follow these steps and you can overcome the issue

  1. in the current branch where you have done commit use “git reset HEAD~1”
  2. then create a new branch “git checkout –b <new branch name>”
  3. then use “git add .”
  4. use “git commit –m <message>”
  5. now do your job, I am not going to write the entire code for you.

Hope this helps.

Leave a comment