Scenario: We've following git workflow:
master branch - has releasable code from individual feature branches
to-be-QAd branch - has code from individual feature branches that is yet to be tested by QA
- I created a branch feature-A from master
- Made few changes committed (commit 1)
- Made few more changes and committed (commit 2)
- Merged branch feature-A in to to-be-QAd branch
- Realized the feature does not work as expected in to-be-QAd branch
- Switched to feature-A branch and did reset --hard to previous commit(commit 1) as the last commit had made code worse
- Made changes and committed (commit 3)
- Merged feature-A branch into to-be-QAd
- A file with correct code (that was part of commit-1) gets merged incorrectly. The merge preserves the file from commit 2. (The file is not modified in last commit.)
Not sure what's done wrong here! It seems to be very trivial thing to do as per my limited knowledge of git.
If I'm doing something fundamentally wrong then what is the right approach in such cases, where you've already merged once, need to go back to previous version in feature branch and merge again.