Getting Started Git Basics Repository
Repository
Learn what a Git repository contains and how it differs from the worktree.
A Git repository is a project folder that Git tracks, together with the history of changes for that project.
When people say "repository" or "repo," they usually mean the whole Git project: the files you are working on now, plus the commit history, branches, tags, and other Git data that belong to that project.
What a repository contains
A repository includes two closely related parts:
- The project files you can see and edit.
- The Git data that stores the project's history and structure.
That Git data includes things like:
- Commits, which record saved snapshots of the project.
- Branches, which point to different lines of development.
- Tags, which give names to specific commits.
- Configuration and references Git uses to keep track of the repository.
In most repositories, the Git data is stored in a hidden .git folder inside the project directory. You usually do not need to work with that folder directly, but it is what makes the folder a Git repository instead of just a normal directory of files.
Repository vs worktree
It helps to separate the idea of the repository from the files currently on disk.
The repository is the full Git project, including its history. The worktree is the current checkout of files that you are editing right now. When you change a file, you are changing the worktree. When you stage and commit those changes, Git records them in the repository history.
Local repository and remote repository
A local repository is the copy of the repository on your own machine. This is the copy GitComet works with directly.
A remote repository is another copy of the same repository hosted somewhere else, such as GitHub, GitLab, or a company server. Remotes are mainly used to share work with other people and synchronize changes between collaborators.
Because Git is distributed, your local repository already contains the history it needs for normal work. You can inspect commits, create branches, stage changes, and make commits locally. You only need a remote when you want to exchange changes with another copy of the repository.
What you open in GitComet
In GitComet, you usually open the local repository on your machine. That means you select the project folder that contains the Git repository.
Once the repository is open, GitComet can show you:
- The files currently changed in your worktree.
- The staged and unstaged state of those changes.
- The commit history and branches stored in the repository.
- The remotes connected to that repository.
If a folder is not a Git repository yet, GitComet cannot show Git history for it until Git has been initialized there or the project has been cloned from an existing repository.