Possible Duplicate:
Is it possible to move/rename files in git and maintain their history?
I am a previous subversion user, not sure how git could help me in following situation.
I have a git repository where my project was contained having multiple dirs, I've been making several commits over this structure
Now I need to make structure changes, so that I move all folders/files at root to a new folder, and I still want to keep commit history of files.
so for example in my repo I currently have a structure like this
src
res
xml
file.txt
.gitignore
I want all of them to be moved in a folder called common, so that I have following structure at the root of repo
common
.gitignore
Is it possible , if so how ?
Thank you
You could use commands like this
mkdir common
git mv src res xml file.txt common
This moves the files and you can still see the history with git log --follow common/file.txt
. If you'd rather rewrite history, check out How can I rewrite history so that all files, except the ones I already moved, are in a subdirectory?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With