> But what gets sent to the other git repo? It is everything that is in objects and under refs.
Not everything under refs. Just the refs that you push. What gets pushed depends on how you configure git, what arguments you provide to `git push` and how the refspecs are configured for the remote under `.git/config`:
e.g., I regularly use `git push origin +HEAD:develop` to force push the checked out branch to a destination branch named `develop`.
A couple additional points not mentioned:
There are also tag objects. You create these with `git tag -a`. These are also called annotated tags. They carry their own message and point to a commit. Without `-a` you create a so-called lightweight tag which is just an entry under `refs/tags` pointing directly to a commit (as opposed to pointing to a tag object).
All those loose objects get packed up into pack files periodically to save space and improve git's speed. You can manually run `git gc` but git will do so for you automatically every so many commits. You'll find the pack files under `.git/objects/pack`:
https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Po...
> But what gets sent to the other git repo? It is everything that is in objects and under refs.
Not everything under refs. Just the refs that you push. What gets pushed depends on how you configure git, what arguments you provide to `git push` and how the refspecs are configured for the remote under `.git/config`:
https://git-scm.com/book/en/v2/Git-Internals-The-Refspec
e.g., I regularly use `git push origin +HEAD:develop` to force push the checked out branch to a destination branch named `develop`.
A couple additional points not mentioned:
There are also tag objects. You create these with `git tag -a`. These are also called annotated tags. They carry their own message and point to a commit. Without `-a` you create a so-called lightweight tag which is just an entry under `refs/tags` pointing directly to a commit (as opposed to pointing to a tag object).
https://git-scm.com/docs/git-tag
All those loose objects get packed up into pack files periodically to save space and improve git's speed. You can manually run `git gc` but git will do so for you automatically every so many commits. You'll find the pack files under `.git/objects/pack`:
https://git-scm.com/book/en/v2/Git-Internals-Packfiles