I'm fairly new to both Git and Ruby, but I'm wondering if this situation is an appropriate time to use Git submodules, or if I should use a different approach.
I'm working on a Sinatra project. There's a gem I would like to use with the code hosted on Github. I need to make some changes to the gem for my project. (Basically, the gem is for working with a certain file format, and the source I'm using doesn't conform to certain standards for this format. I think it would be easier to adjust the gem rather than try to fix the files). I don't think the changes I'm making would be of any use to most other people, so I wasn't planning on forking the project.
What I was thinking of doing was adding a submodule to my project for the gem project, and then making my changes in there. I don't plan on ever needing to push any of these changes to a separate repository, but I thought it would be nice to be able to pull any changes the authors of the gem make to merge in with my changes if they add any additional functionality.
Does this seem appr开发者_高级运维opriate?
That's not quite how submodules work. You need somewhere to push your changes, or anyone else who fetches your repo won't have a place to pull the submodule from. You could just make a sibling repository in the same place your main repo is stored, and you can have that be the official source for the submodule. You can still pull upstream changes from the gem into your repo, you just have to push the resulting merge and changes to your submodule's remote.
精彩评论