Reputation: 29942
I have downloaded an archive of some large GitHub repository using Download ZIP link. It contained just the source code, so it wasn't a clone or a git repo anymore. Then I made some changes in this code on my disk and now I want to update it using the code of HEAD revision from the original GitHub repo (which has changed since I downloaded the ZIP file). But it's a large repo, so I don't want to download all the files, but just the modified ones.
Should I git init
a new repo in my existing source code folder, then git add .
and git commit
then git remote add origin https://github.com/someuser/someproject.git
and git pull origin master
? Will this download only the modified files?
Upvotes: 5
Views: 5663
Reputation: 1326872
Will this download only the modified files?
No, Git always works with all the files of a repo. In your case, git pull against an almost empty repo (only one revision) would still fetch all the revisions.
It is really easier to simply clone the repo (even if it is a large one), and copy over your modification, git add
, commit and push: that will push only the modified files.
From Git 1.9.0, you could consider a shallow clone (cloning only the last revision), since you now can push from said shallow clone.
See "How to git fetch efficiently from a shallow clone".
Upvotes: 2
Reputation: 559
It is easier to make a clone and commit/push your changes. If you do not know how to use Git see this:
http://try.github.io/levels/1/challenges/1
Upvotes: 0