I have one version of a file at commit " #abc123
" and the current version of the same file locally.
I want to MERGE, NOT REVERT, the two versions for only this file.
I read about some workarounds using " git cherry pick
", but nothing direct.
Is there a simple way of doing this?
I would:
make sure the current version of that file is committed.
switch to a new branch from the current commit:
git switch -c tmp
restore that one file from the old commit:
git restore -s abc123 -SW -- aFile git commit -m "restore old version of a file
finally I can merge two commits, which will merge only that one file
git switch main (or master) git merge tmp
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.