1

I worked with SVN till today so I'm not very familiar with the advanced features of git.

I want to clone a repo containing some files that I use in my project. My project is in a reposiory of its own so when I commit the files they go under my project. If I change them, they are also committed in my project.

However, I want them to be seen as a pull request to the repo I took it from.

In SVN I used svn-externals for that. How can I do it in git so it stays easy?

4

2 に答える 2

2

そのために使えますgit submodule

git の最近のバージョンでは、git サブモジュールがサブモジュール リポジトリの最新のコミットを追跡できるようになりました。
Git1.8.2 :

" git submodule" は、(スーパープロジェクトの gitlink に記録されたコミットと統合するのではなく) リモート ブランチの先端と統合する新しいモードの学習を開始しました。

# add submodule to track master branch
git submodule add -b master [URL to Git repo];

# update your submodule
git submodule update --remote 

マニュアルページから:

--remote

updateこのオプションは、コマンドに対してのみ有効です。
スーパープロジェクトの記録された SHA-1 を使用してサブモジュールを更新する代わりに、サブモジュールのリモート追跡ブランチのステータスを使用します。

svn externalそれは通常の動作に近いです。

于 2013-04-11T07:54:49.867 に答える