Reputation: 3092
In a project I'm currently working on, I have a file with roughly the following history:
Now, I regret having deleted the vast majority of the file and I want to revert back to the initial file (some 100 commits ago) but with all modifications except the deletions since then.
In other words: Every line that exists in the latest commit should be taken from that, every line that's not in there should be taken from the first commit.
How can I achieve that?
Upvotes: 2
Views: 120
Reputation: 536028
I would suggest using a third-party tool to show you the initial file and the current file side by side and just perform the fix manually. It's unlikely that there's any automatic solution; you could git checkout --merge
the original file from that first commit, but if you're unlucky you might not get a merge conflict, and if you're lucky and you do get merge conflict it's unlikely that it would be a very good place to work from.
Upvotes: 1