How does git push work?

I have a large project (several hundred MB), if I use a remote GIT repository, does the GIT client make the entire directory, even if you make a small change in one file?

thanks

+4
source share
3 answers

No, the client and git server agree on a list of objects that have been changed, and only those that have been sent are sent. The only time you send more than absolutely necessary is to use a "dumb" HTTP server and select the complete package containing more objects than is required on the client.

http://book.git-scm.com/7_transfer_protocols.html contains some protocol details at a technical level and should give you terminology to go further if you are interested in how and why.

+8
source

Not. Git only copies the changes that were made with each commit since the last click.

+2
source

"Push" is a Git way of synchronizing repositories - in your case, synchronizing a local repo with one sitting on a remote server.

Repository β€œupdates” occur when you make changes (in fact, technically, when you β€œadd”, but deeper than necessary). When you commit, Git simply stores information about delta changes that you have made since the last commit (these are not β€œduplicate” files). But this fixation is only on your local machine until you click. When you click, Git simply synchronizes the updates you made in the local repo with the repo on the remote server.

Pro Git is a simple and wonderful read, and it will explain such things well: http://progit.org/book/

+2
source

Source: https://habr.com/ru/post/1397138/


All Articles