Reputation: 29
I have a main branch and a feature_branch.
I did:
git checkout feature_branch
git rebase main
What I want to do is get all changes from main
for all files but 1, keep changes done in feature_branch
for that file.
How to do that?
Upvotes: 1
Views: 52
Reputation: 522506
What you can do is to simply reset the one odd file back to the original branch before the rebase or merge. You could try:
git checkout feature_branch
git log
# take note of the SHA-1 hash for the HEAD commit (e.g. abcd1234)
git rebase main
git checkout abcd1234 -- path/to/file_to_keep.ext
git commit -m 'Reverted single file to original version'
Upvotes: 1