How does GIT Push work?

前端 未结 3 1896
既然无缘
既然无缘 2021-01-13 19:51

I have a large project (several hundred MB), if I use a remote GIT repository, does GIT client push the entire directory even when you only make small change in a single fil

相关标签:
3条回答
  • 2021-01-13 19:54

    No. Git only copies over the changes that you made at every commit since the last push.

    0 讨论(0)
  • 2021-01-13 20:04

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

    Repository "updates" happen when you commit changes (actually, technically when you "add", but that's getting deeper than necessary). When you commit, Git is just storing information about the delta changes you've made since the last commit (it's not "duplicating" files). But that commit is only on your local machine until you push. When you push, Git is just syncing the updates you've made in your local repo with the repo on the remote server.

    Pro Git is an easy and great read, and it'll explain things like this nicely: http://progit.org/book/

    0 讨论(0)
  • 2021-01-13 20:12

    No, the git client and server negotiate a list of what objects have changed, and only those are sent. The only time you transmit more than is absolutely necessary is using a "dumb" HTTP server, and fetching a complete pack that contains more objects than are required on the client.

    http://book.git-scm.com/7_transfer_protocols.html has some detail on the protocol at a technical level, and should give you the terminology to go further if you care about the how and why.

    0 讨论(0)
提交回复
热议问题