DEV Community

Discussion on: Git & GitHub made simple - Undoing commits

Collapse
 
didof profile image
Francesco Di Donato

Thank you so much for your comment, I appreciate it and it's really informative. I'm planning on next days to edit this post and add the "git revert" command.
With your permission I'd like to add your information (quoting your name of course) 😁

Collapse
 
thajeztah profile image
Sebastiaan van Stijn

Ha! I didn't know you were brothers ☺️

Yes definitely avoid reflog if you can; it's not something you'd use in your daily flow.

Tips I would have;

  • branches are "cheap" when using git; working on some changes and want to try some variations? create a new branch from your current one and try what it looks like. It's easy to remove the branch later
  • working on a merge conflict, and afraid you'll screw up? just create a new branch as backup before you start.

Adding to the "merge conflict" case; if you need to rebase a pull request (and/or fix a merge conflict); GitHub can be your backup; as long as you don't "push", you can always return to the previous state (without using reflog πŸ˜‰)

Feel free to use whatever I wrote in your blog; I enjoyed reading your write up, and hope it helps others get comfortable in the world of Git black magic