Reputation: 73
I'm using a remote git repository with multiple branches.
From the documentation I understand that I switch between branches by doing
git checkout master
or
git checkout branchname
I also understand that the repository is cloned onto my local machine (and that this is updated by doing git fetch)
But when I do
git checkout master
git checkout branchname
git checkout master
in quick succession the system clearly downloads stuff from the server (at least, /sbin/ifconfig shows I'm downloading tens of megabytes)
What have I misunderstood here?
Upvotes: 2
Views: 440
Reputation: 1326596
system clearly downloads stuff from the server
No, git checkout
is a purely local operation, based on the full history of the repo cloned locally.
You could shut down any network connection that it would still work.
Even when you do a checkout of a remote branch (also described here), it is still local (since said "remote" branch is actually fetched and stored in the local namespace called "remotes")
git checkout --track -b haml origin/haml
Upvotes: 3