1

I was invited to collaborate on a git project which is very large. I need to push just a few files into it via merge request.

The files I need to push will be located in distinct folders inside the project, but I'd like to push them altogether, as it will close a single issue.

I already forked this repo and I'm wondering if is there a way I can push to this repo via

$ git checkout -b newbranch
$ git add .
$ git commit -m "hello world - issue #1"
$ git push origin newbranch

without cloning all its content into my PC first?

Thanks in advance!

Virtua Creative
  • 1,721
  • 1
  • 10
  • 17
  • I don't think you can avoid a clone of _some_ sort. If your version of Git is 1.9+, you might be able to do this by combining a shallow clone (i.e. specify the `--depth` flag using `clone`) with creating a patch with your changes. See https://stackoverflow.com/questions/11375070/pushing-to-github-after-a-shallow-clone – miqh Feb 16 '16 at 23:55
  • Thanks for your input @miqid! But I couldn't follow the question you mentioned... I'm not an expert on git, I just handle the basics. ;) – Virtua Creative Feb 17 '16 at 00:27

1 Answers1

2

To get just the past X commits, use git clone --depth=X. This should cut down on the size dramatically.

David Deutsch
  • 13,210
  • 3
  • 41
  • 45