Punter Vicky
Punter Vicky

Reputation: 16992

Adding reverted commits back to main / master branch in Github

I had a branch test which I merged to master branch.

After the merge, I identified that there was an issue with my code and so reverted the commits associated with test branch.

Now if I merge changes from master to test branch , the changes in the test branch are overwritten as I believe master is considered to be the latest.

Is there a way for me to add the required fix in test branch and merge it back to master?

Upvotes: 1

Views: 44

Answers (1)

VonC
VonC

Reputation: 1324208

It is best to avoid merging integration branches (like master, which receives merges from multiple branches, to integrate them) to topic branches (like test).

Ideally, you would fix the issue in test first, then merge test (again) to master, to report the fix.

In your case, since you worked on master first, you might consider rebasing test on top of the new master (and force pushing test).
test (once rebased) will then be ready to be merged again later on to master.

Upvotes: 1

Related Questions