Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undo reverting changes in one branch

I have created a branch branch1 from master.

created a file test1.txt in branch1:

test1.txt

some logic

Then I merged branch1 to master. But I realized that the logic implemented in branch1 is not properly tested. So I have removed the logic in test1.txt and directly committed in master.

Now the file in master will be like this:

test1.txt

removed logic

Then I switched to branch1 and tested the logic. Since the logic looks fine, I didn't make any changes to the files.

When I tried to merge these changes to master, it shows the following message:

Already up to date.

How can I merge these changes to master?

like image 600
din_oops Avatar asked Sep 16 '26 10:09

din_oops


1 Answers

There are several way to do this.

One of them is : on your master branch, revert the commit where you deleted the logic

git revert <sha1>

This will create a new commit, which re-enables said logic.


Or you can simply edit the file by hand, to reenable the logic (you may copy/paste the relevant chunk from the version in branch1), and commit on master.

like image 163
LeGEC Avatar answered Sep 19 '26 02:09

LeGEC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!