I have a 3 month old commit, lets say commit A which touchs 3 files Over the last 3 months, a lot more commits have gone in, some of which have added new code below changes from commit A
I want to remove (not revert) the changes from commit A in 1 of the 3 files.
remove as in blank line instead of code
I tried
git show < commit hash of A > file_path | git apply -R -3
this removes extra code (which is outside the scope of commit A: details below if interested)
One way i can think of is using git blame on file, wherever hash matches, remove the lines but seems to be very iterative process and time consuming.
Any pointers would be helpful..
Thanks in advance
Extra code removed from file which is out of scope of commit A:
- Commit A was added at the end of file
- New commits added more code after commit A (below changes from commit A) at the end of file
- now when we reverse the changes in commit A (using git apply -R -3), it cleans from start of commit A till end of file because to git, the code was originally added at the end of file