How to return a bad fix in GIT?

I am sure that there is a GIT group of users who have had this problem:

  • Create a branch from the wizard. Let me call it featureX.
  • Somewhere, while working on featureX, you realize that you want to fix the previous commit:
    • You commit your fix.
    • You do your reboot and squash / patch.
  • Later, you would like to reinstall your host to incorporate the latest changes in featureX.
  • Things break because your branches diverge (the fix was not done by the wizard). You have a bad day.

This is the second time this has happened to me. The first time I didn’t have much history in featureX and just made a new branch from the master. What do you take on? How would you solve this? Is it possible to git reset to create a specific log? In this case, I could undo the rebase and move the fix fix on top of the X function (using interactive rebase).

I am sure there are different ways to do this, but I think this is a common problem.

+4
source share
1 answer

Yes, you can reset any branch to everything that has been checked before (reflog). Since your fix is ​​still in FeatureX, rebase will only behave as if you were not performing the fix β€” this only matters if the host discrepancy conflicts with any of the commits in the featureX commit or not.

Secondly, when people first learn git, they fall in love with the awesomeness of reinstalling. But I returned to the merger. It's easier, it marks the story of how it happened, and it forces discipline. Here is my workflow: http://dymitruk.com/blog/2012/02/05/branch-per-feature/

+1
source

All Articles