1

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?

xdazz
  • 158,678
  • 38
  • 247
  • 274

1 Answers1

2

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
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Yes, I now realise that the results of ifconfig, and the time it took, were the NFS connection to our local fileserver. It seems that git works very badly with NFS – user2423780 Feb 16 '18 at 01:12