I have two branches 'master' & 'child'.
- I added a commit on the child branch and merged it onto the master branch.
- I reverted this commit on the master branch(and also on the child branch separately).
- I added the same changes from the first commit on the child branch(kind of like revert of revert, but added as a new change via new commit).
- When I try to merge child onto the master now, it is not taking in those changes.
Is this how git is supposed to work?
Created a test repo and replicated this for reference. master (https://github.com/ashok-r/test_repo/tree/master), child (https://github.com/ashok-r/test_repo/tree/child)
- Added a commit(https://github.com/ashok-r/test_repo/commit/fc82cf72a1d284f4eea2354a80ba9bd55fd666d6) on child and merged it onto master.
- Reverted this on both master and child branches.
- Added the same change again on child (https://github.com/ashok-r/test_repo/commit/184d08c0ebee1cd5bf88bb042695d45786af20a7)
- Merged child onto master (https://github.com/ashok-r/test_repo/commit/174aad5b1672c32418d1f47c0f83f756fe94b40e), but the change doesn't get included.
Bit of a background as to how we ran into this problem. We use 'master' branch as a stable branch and other branches for development. We had to revert a commit(Let's call the changes 'A'). Instead of doing it on development branch and bringing it onto master, we reverted on the master branch itself. After a few days, we added a new commit on the development branch which includes those reverted changes('A') along with some other changes('B'). When we merge this onto master, only the new changes('B') gets added and the previously reverted changes('A') are ignored. Is this the expected behaviour? It looks strange to see some changes from a commit gets added while some changes are ignored.
I know its not ideal scenario to commit/revert directly on the stable branch, but if we did, those exact changes can't be brought back via another branch?