Here's the scenario:
- I have finished working on my feature branch A.
- I commit my changes and check out in development
- I merge the feature branch A into development
- before I git push, I realize that I forgot something in the feature Branch A (delete inline comment)
Can i do again?
- check out to feature branch A and delete the comment.
- Then commit the change and check out again in development.
- Then again merge the feature branch A into development.
Question Is this possible follow steps 1 to 7 or I have to do create a new branch afterwards point 4.
to make the changes? Thanks in advence!
CodePudding user response:
The simplest thing, since you have not pushed, is just reset hard to the commit before the merge commit in development. Assuming the merge is the last you thing you did in development, you would say:
git switch development
git reset --hard @^1
So now it is exactly as if you never merged! So then switch to the feature branch, fix it, and do the merge again.
CodePudding user response:
Yes, you can merge again (and again and again...).
This is how the graph would look like after this operation (numbers indicate steps in your scenario, ie. 3 and 7 are merge commits):
development --------3----7---
/ /
feature/A ------2----6