Reputation: 383
I am using to track changes to some linux system files (/etc/*), I had the .git in /etc but now I decided to move it to / as I want to track files that are outside /etc (both /etc and / are in the same filesystems...), I did that and tried to re-add the same files with:
git add $(git status | awk '/deleted/ { print "etc/"$3 } ')
But it does not appear to be working as I hoped as now the are two lists one with a list of "new files" and one with a list of "deleted files", if commit now I will lose all the history for the files....
What would have been the correct steps?
Thanks! Antonio
Upvotes: 1
Views: 117
Reputation: 59
Ther are similar questions on SO:
My Git repository is in the wrong root directory. Can I move it? (../ intead of ./)
And there is no way of chaning directory without losing history of files.
Upvotes: 2
Reputation: 42903
Use git subtree
(installation instructions if not already installed).
Create a new repository at /
and merge it with the existing one in /etc
:
$ cd /
$ git init
$ git subtree --prefix etc /etc master
Upvotes: 3