git cp orig copy

Dec 09, 2023 20:21


Problem: I want to copy a file in git and preserve its history.
Solution: Holy guacamole!:

git checkout -b dup
git mv orig copy
git commit --author="Greg " -m "cp orig copy"
git checkout HEAD~ orig
git commit --author="Greg " -m "restore orig"
git checkout -
git merge --no-ff dup

Previous post Next post
Up