8

I have a repository with lots of binary files (about 250MB) - I don't know if that is important.

I'm making a new branch and trying to publish it on the central server:

git checkout -b newbranch
git push origin newbranch:newbranch

Now here, git is trying to push 30MB of data to the server. Why?? There are no changes.

Also tried to make a bundle:

git bundle afile master..newbranch
fatal: Refusing to create empty bundle.

What is wrong?

stach
  • 2,135
  • 2
  • 20
  • 22
  • that is interesting. good question mode (the bundle example is really good for proving the context) – sehe Apr 14 '11 at 10:20
  • And `origin` is really the remote repository you retrieved the orginal branch from? – KingCrunch Apr 14 '11 at 10:40
  • It is the original repo I cloned from. – stach Apr 14 '11 at 11:07
  • I tried git gc, git prune to no avail. Plain old diff shows that a newly cloned repo (from the same server) differs in .git/logs/ and both repos have large (210MB) files inside the .git/objects/pack dir, and that files are different (name and content). Is there any command I could inspect the differences with? – stach Apr 14 '11 at 12:06
  • 1
    I gave up - I created a new remote, exactly identical to the origin, a told git to fetch it. Almost no data was downloaded. Then I created a local branch out of it (new_master), and another branch (new_copy). I could successfully push the new_copy to the server without sending any large amount of data over network (using the new remote) Still it would nice to know what was wrong with the original remote. – stach Apr 14 '11 at 12:46
  • which operating system and git version is the client? – Milan Babuškov Apr 14 '11 at 17:34
  • I also created a branch, made two small commits and when I pushed the branch in the server, there was a lot of data sent. – Nicolas Zozol Nov 16 '12 at 15:38
  • I experienced almost the same now, in my case I did branch, a few commits in the branch, then push ... and transfer was 250 MB, which looks like the whole repository. The git output was: `Writing objects: 100% (35142/35142), 250.63 MiB | 47.00 KiB/s, done. Total 35142 (delta 14452), reused 34619 (delta 14347)` – Suma Jan 20 '16 at 09:05
  • [This](https://stackoverflow.com/a/34888813/2303202) could be a reason – max630 Jan 20 '16 at 21:59
  • @max630 This seems very likely. I encountered it several times again, I aborted the push which took very long and each time there was a new commit in the remote master, and as soon as I fetched it, the push was done as expected. – Suma Mar 07 '16 at 09:36
  • Possible duplicate of [Why did git push so much data?](http://stackoverflow.com/questions/34820019/why-did-git-push-so-much-data) – Suma Mar 07 '16 at 09:36

2 Answers2

0

It's to do with the way git stores the data and how a push works. I'm guessing that pushing the new branch is not what's causing the data transfer but a previous commit that's also missing from origin is being pushed as well.

This is why git's a very bad idea for log files - I tend to add them to the .gitignore file so they never get committed, even by mistake :)

deanWombourne
  • 38,189
  • 13
  • 98
  • 110
  • a bit of smoke and mirrors tactics there – sehe Apr 14 '11 at 17:41
  • No, a new checkout with a new remote has the same HEAD hash as the existing one, so one commits were outstanding. – stach Apr 14 '11 at 19:24
  • no commits are outstanding _for that branch_ - that doesn't mean that there definitely aren't objects in your repository that aren't in the remote, it just means that they aren't part of your new branch. – deanWombourne Apr 15 '11 at 10:25
  • 1
    Ok I understand the reasoning - maybe there were some objects - but where did they come from (the HEAD was the same)? And how I can check what is inside those objects? – stach Apr 15 '11 at 20:59
-1

Maybe not a useful answer, but I tried this exact thing, and git didn't send up any objects. So maybe there was a commit in there, and you didn't realize it.

John Szakmeister
  • 44,691
  • 9
  • 89
  • 79