How it works
A Git repository stores files and the complete history of changes. Each commit is a snapshot. Branches enable parallel development. Services like GitHub and GitLab host remote repositories and make collaboration easier via pull requests.
The repository also holds metadata: README, license, issues and documentation. A typical structure includes src, tests, docs folders and configuration files.
Versioning lets you go back to any previous state, compare changes and collaborate without overwriting work.
Practical example
git init meu-projeto
cd meu-projeto
echo "# Meu Projeto" > README.md
git add .
git commit -m "commit inicial"
git remote add origin https://github.com/user/meu-projeto.git
git push -u origin mainRecommended structure:
meu-projeto/
src/
tests/
docs/
README.md
LICENSE
.gitignoreWhat it's for
Version and share code. It is the basic unit of collaboration in software. In AI workflows, code agents work inside repositories, creating branches and commits.
A good repository has a clear README, a defined license and an organized history.