SpinTheMic
Pro

Interview practice question

Committed to the wrong branch

Cloud & DevOps · Git and Version Control · Beginner

You accidentally made two commits on main instead of a feature branch, and you haven't pushed yet. How do you fix it?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • Create feature branch at current commit.
  • Reset main back (git reset --hard origin/main).
  • Only because unpushed.
  • Switch to feature branch.
  • Verify with git log.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics