空のリポジトリがあり、更新をプルするためだけに使用git init
する別のリポジトリをプルしたい場合、ルート ディレクトリにファイルを配置するにはどうすればよいですか?
そう、
まあ言ってみれば:
cd ~/repositories
mkdir newrepo
cd newrepo
git init
echo "testfile" > readme.md
git add .
git remote add <whatever>
git push -u origin master
#ok so that part works fine
#now we have our repository at <my_other_repository> that looks like
#a_root_file.ext
#directory/another_file.ext
#so now I want to run something like:
git clone <my_other_repository>
#and end up with:
#readme.md
#a_root_file.ext
#directory/another_file.ext
#if I then run
echo "edited testfile" > readme.md
git status
#I want to be told that
#untracked changes
#newfile: a_root_file.ext
#newfile: directory/another_file.ext
#modified: readme.md
#running
git commit -a -m "Some files from another repository"
git push
#should push everything up to the <whatever> repository
#then I want to be able to run
git pull <my_other_repository_name>
# and have it pull in any upstream changes
これは設定できるものですか?
「ラッパーディレクトリ」を用意することで、少し回避できると思います
cd ~/repositories
mkdir newrepo
cd newrepo
git init
git remote add <whatever>
mkdir wrapper #this will now be the root of my project
cd wrapper
echo "testfile" > readme.md
cd ../
git add .
git push -u origin master
その後、問題なく実行できるはずですgit clone <my_other_repository>
が、これは1つのリポジトリでのみマージしたい場合にのみ機能し、複数のリポジトリでマージしたいと考えており、2つのリポジトリが監視しているため、何が変更を追跡しているのか疑問に思っています同じファイル、両方がそれらを追跡しますか? または、<whatever>
「これらはこのリポジトリの下にあるので、追跡しません!」と言うでしょうか?