I want to somehow change the git directory structure. Currently the architecture is like
VL(repo) .git (hidden) code files ...... ..... I want it like html(repo) .git VL code files ...... ......
I had a solution to archive the current repo and then create the new repo with above structure. But the bad thing about this approach is that it removes all previous history. is there any better solution?
The Git file directory is structured like a tree. It starts with a HEAD that points to the latest commit on the working branch. The HEAD will always show you where you are working from on Git Bash. Imagine you are driving and arrive at a crossroads and point your car in one direction.
Changing the name of the root folder from VL
to html
shall be no problem since git only works on the directories below that level.
So, what's left is introducing the folder VL
below the html
folder and move all code files
there:
mkdir VL
git mv <all your code> VL
git commit -m "moved all my code under VL"
Using git mv
you tell git that you moved things, so it could still keep track of the history.
Edit:
As Benjol notes in his comment, using git mv
is not neccessary. You could achieve the same by copying <all your code>
to VL
, then do
git add VL
git rm <all your code>
git commit -m "moved all my code under VL
git is smart enough to recognize the movement.
Move your code manually. Then,
git add -A
git commit -m "moved code"
Done.
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