Git's local repository and remote repository -- confusing concepts

As I'm experiencing exactly the same questions like yours (coming from VSS and TFS mindset) and during the last 3 days started to understand. I would believe that these kind of diagrams would be more helpful to understand the whole picture for anyone else trapped there.

from: https://greenido.files.wordpress.com/2013/07/git-local-remote.png?w=696&h=570

Git Flow diagram 1

Another one, from: https://wiki.lsr.ei.tum.de/lib/exe/fetch.php?media=nst/programming/git_flow.jpg&w=500&tok=e87798

Git flow diagram 2


Git is a distributed version control system and it makes Git awesome. Your local repository has exactly the same features and functionality as any other Git repository. So a Git repo on a server is the same as a Git repo on GitHub (granted GitHub adds additional features, but at its core, you're dealing with Git repositories) which is the same as your coworker's local repo.

So why is that awesome? Because there is no central repo you have to have access to do your work. You can commit, branch, and party on your own repo on your local machine even without internet access. Then, when you have a connection again, you can push your changes to any other Git repo you have access to. So while most people treat a particular repo as the central repo (repository), that's a process choice, not a Git requirement.

The point of all that was to state (as others have) that you're committing your README to your local repo. Then, whenever you choose, you can push changes from your local repo to any other repo. It's pretty nifty!


Your quoted statement is correct.

You don't need to have a remote repository at all.
You can have the full git experience, with commits, branches, merges, rebases, etc, with only a local repository.

The purpose of a remote repository (eg, GitHub) is to publish your code to the world (or to some people) and allow them to read or write it.

The remote repository is only involved when you git push your local commits to a remote repository, or when you git pull someone else's commits from it.

Tags:

Git

Repository