开发者

Git remote branch reuse huge files

Hi I have 2 local branches - master and test.

I added a 20MB file to branch master and pushed it to the remote master.

Now I merge master into test. and pushed test to the remote test.

Now I have to upload the 20MB again. Anyway around this issue?

Both remote branches are on the same remote.

(master) touch hugefile
(master) git add hugefile 
(master) git commit -m "huge"
(master) git push origin master  (upload 20MB)
(test)   git merge master
(test)   git push origin test       (< upload 20 MB again)

SOLUTION

T开发者_如何学JAVAhere may be a problem with autocrlf=True and binary files that are detected as text.

I worked arround this issue by forcing git to detect *.pdf files as binary files.

http://www.bluishcoder.co.nz/2007/09/git-binary-files-and-cherry-picking.html


Git will not upload the file again. The file contents will be stored as blobs in the repository which multiple commits can point to (via. trees). When you do your new commits, the tree objects created for them will point to the file you added the first time. In your specific case, the merge will simply move the test branch to the same position as head and send that information back to the server when you push. There will be no addition of files at all.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜