What is a Git repository?
A repository is a project together with the history Git keeps for it. The hidden .git directory contains Git's internal information: commits, references, configuration and the data needed to reconstruct previous versions.
A commit is a snapshot.
A commit records a version of your project at a particular point in time. It also contains metadata such as the author, message and links to the commit's parent snapshot.
That means a history is a chain — or, with branches and merges, a graph — of snapshots.
A branch is a movable name for a line of history.
A branch does not copy your project. It is essentially a name pointing at a commit. Creating a branch gives you a separate line of development while the existing history remains intact.
main → stable history · feature/login → your new work
HEAD means “where I am right now”.
HEAD normally points to your current branch, and that branch points to your current commit. When you switch branches, HEAD follows the branch you selected.
If HEAD points directly at a commit instead of a branch, Git calls that a detached HEAD. It is useful, but it can feel strange until the pointer model makes sense.
The staging area is your next snapshot.
When you edit a file, the working tree changes. When you stage it, you tell Git which version of that file should go into the next commit.
A remote is another copy of the repository's history.
A remote such as a GitHub repository gives your local repository somewhere to exchange commits with. The remote is not your project itself — your local repository is still a complete Git repository.
That distinction explains why you can commit without an internet connection.
Merging joins two lines of history.
Suppose main and feature/login have both moved forward. A merge combines the histories so the changes from the feature can become part of the target branch.
If both branches changed the same part of a file in incompatible ways, Git cannot safely choose for you. That is a merge conflict.
Push sends commits. Pull brings history in.
Push sends commits from your local repository to a remote. Pull gets changes from the remote and integrates them into your current history.
Put the pieces together.
You edit files in your working tree. You stage the changes you want. You commit a snapshot. Branches give those snapshots different lines of development. HEAD tells you where you are. Remotes let repositories exchange history. Merges bring lines back together.
That is the core of Git. The commands are interfaces to this model.