Reputation: 30421
I have this project and I'm using github for the first time. My question is regarding forks. My problem is that I want to fork this code I saw in github but I also want to use it in my existing project and work on the fork from there. Do I download the files then integrate it into my project
git add foldername/
git commit -m 'Added some awesome code from github'
git push -u origin master
or is there a way to retain it as a fork but have it as a branch in my repository? Or am I talking crazy here?
Upvotes: 2
Views: 805
Reputation: 1323953
Your solution would be closer to the subtree merge, which is great if the two repos are closely linked together and can now evolve within one repo.
But you want to contribute back to your fork, in order to make some pull request back to the original project.
As three said in the comments, git submodules are more appropriate, as described in this answer:
For two different sets of files with different history and different pace in their evolutions (commits), you can reference your fork within your main project as a submodule.
Upvotes: 1