DEV Community

Discussion on: 04 Git: Branches Are Breathtaking 🔥

Collapse
 
mahmoudalfall profile image
mahmoud-alfall

hi, i wanted to know how to convert my code to another code that i commited. is there is something similar to branch's checkout for that?

Collapse
 
sereneinserenade profile image
Jeet Mandaliya

It'd help if you could make the scenario a bit clearer.

In general, if we want to roll back to older commits, we can use git revert. We can also delete commits with git reset --hard HEAD~x where 'x' is the number of last commits that you'd like to delete. But revert is always a better option as that way our code always stays in git.

Collapse
 
mahmoudalfall profile image
mahmoud-alfall

thank you very much. and i'm sorry that my english isn't good

Thread Thread
 
sereneinserenade profile image
Jeet Mandaliya

glad i could help