开发者

How would I expand the 'scope' of an existing git repository to a parent directory?

I have a git repository in a directory a/b/, and I want to expand this so changes to a/ and subdirectories are stored too. Is开发者_高级运维 there any way to do this simply?


Move b to somewhere new, make a new directory in it called b and git mv the contents into it. Now cp the stuff from a (excluding the original b of course) into here and git add them.


Try this, starting from to dir of the git repository:

$ mkdir b
$ git mv * b/
$ git commit  # describe that contents have moved
$ cd ..
$ mv b/* .
$ rmdir b


Just move the .git directory one level up and git add -A all files. For git it will look as if the existing files moved to a subdirectory and some new files appeared.

cd a/b
mv .git ../
cd ..
git add -A .
git commit -m 'Move git directory one level up'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜