سؤال

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

هل كانت مفيدة؟

المحلول

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

نصائح أخرى

Ther are similar questions on SO:

My Git repository is in the wrong root directory. Can I move it? (../ intead of ./)

Moving a git repository

And there is no way of chaning directory without losing history of files.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top