Here’s a sequence of unbelievable things:
- Yes, despite a lifetime in Subversion, I’m really this new to git!
- I’m going to link to Livejournal in this post!
- Git really doesn’t have an equivalent to
svn cp filename
!
I spent a surprisingly long time reviewing the man pages and surfing the internet to confirm this, but git really assumes you’ll never want to copy a file with history. Here’s that Livejournal link I promised, where markpasc has similar complaints — from 2008, no less.
I was looking for a way to copy a file with history because I needed to break a single file into multiple pieces. In my Subversion days I would have done a svn cp old-file.php new-file.php
. From there I could prune old-file.php
and new-file.php
down to what I needed while preserving the full history for all the code that remained.
Or perhaps I’m missing something?