If I have a main project that is version controlled.
I then add a remote for a third party plugin
git remote add myplugin <url>
I can then do git pull myplugin master
and it just pulls in the changes from that remote.
Now lets say my project is setup as:
/
/index.php
/whatever
and the remote is setup as
/
/whatever.php
when I pull in the remote I end up with
/index.php
/whatever
/myplugin
/myplugin/whatever.php
this is good.
What I am wondering is, If I make changes to myplugin,
If I issue git push myplugin master
what is pushed?
Is it going to only push changes in myplugin? or does a remote act as a second repository and will commit the entire repository?
You would end up, after a git pull myplugin
, in /myplugin/whatever.php
only if the remote repo already contained /myplugin/whatever.php
(not juut whatever.php
)
Adding a remote means pulling all its history and merging it into your repo, or pushing your commits from all your repo into the remote (not just the changes from your local 'myplugin
').
What you are describing (pushing only the changes from 'myplugin', or pulling commits only in 'myplugin') is called submodules.
git submodule add url/myplugin myplugin
That would add a directory myplugin, in which you would find a second nested Git repo acting like you describe in your question.
It isn't just a new remote, but a submodule url for including in a subdirectory another repo at a specific SHA1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With