DEV Community

Discussion on: Git Organized: A Better Git Flow

Collapse
 
sargalias profile image
Spyros Argalias

Very nice post. I use this process as well.

The only step I sometimes do differently is: Before resetting my feature branch, I copy it. I branch off the latest commit of my feature branch into a "temp" branch. Then I follow your steps.

However, if I mess up my afterwards, I can just reset my feature branch again and fast-forward merge my temp branch into my feature branch, bringing it back to the original commits before I reset anything. This means I don't have to mess around with the reflog, which can be quite complicated.

Thanks and keep up the good work 👍

Collapse
 
elisboa profile image
Eduardo Lisboa

Instead of copying, you could make an empty commit (and tag it, maybe), so you would have the exact point-in-time where to go back if needed. Could be something like:

git commit --allow-empty -m"This is fine for now"
Enter fullscreen mode Exit fullscreen mode

Your branch-copy approach is interesting as well, because you can just checkout to the backup branch and go back to where you wanted.