Git shortcut for moving tracked resources
SoftwareYes, I didn't know this until today, much like there's someone born every minute who hasn't seen The Flintstones. Previously to move a file, I would have done this:
$ mv ./original ./new $ git rm ./original $ git add ./new $ git commit -m 'moved original to new'
As an aside, you can also do git rm
to remove the file and tracking, or use -f
to just do the latter. I'm old fashioned, and prefer my source control just track stuff, rather than manipulating stuff directly. Stuff being the operative word. But I digress.
Not to get all Malcolm Gladwell on you (and stuff), but turns out, there's a mv
command instead:
$ git mv ./original ./new $ git commit -m 'moved original to new'
This way, the files are also associated, and stuff.