In this guide, you will learn the fundamental Git commands to get started with version control.
To use Git, you first need to install it. Follow the instructions for your operating system:
Before using Git, set your user information:
git config --global user.name "Your Name"
git config --global user.email "your-email@example.com"To start tracking a project, navigate to your project folder and run:
git initThis will create a .git folder where Git stores all version history.
To check which files have been modified or staged for commit, use:
git statusBefore committing changes, you need to add files to the staging area:
git add <file>to add all changes in the directory:
git add .Once files are staged, save your changes with a commit:
git commit -m "Describe the changes you made"To view the history of commits in your project, run:
git logTo clone an existing repository from GitHub:
git clone <repository-url>To send your commits to a remote repository (e.g., GitHub):
git push -u origin main
To pull the latest changes from a remote repository:
git pull origin mainThese are the basic commands you will use to manage your projects with Git.
- PT-BR
Neste guia, você aprenderá os comandos fundamentais do Git para começar a usar controle de versão.
Para usar o Git, você precisa instalá-lo. Siga as instruções para o seu sistema operacional:
Antes de usar o Git, configure suas informações de usuário:
git config --global user.name "Seu Nome"
git config --global user.email "seu-email@exemplo.com"Para começar a versionar um projeto, navegue até a pasta do projeto e execute:
git initPara verificar quais arquivos foram modificados ou estão prontos para commit, use:
git statusAntes de fazer commit das alterações, você precisa adicionar os arquivos à área de stage:
git add <arquivo>Para adicionar todas as mudanças no diretório:
git add .Depois que os arquivos estiverem no stage, salve suas alterações com um commit:
git commit -m "Descreva as alterações que você fez"Para visualizar o histórico de commits do seu projeto, execute:
git logPara clonar um repositório existente do GitHub:
git clone <url-do-repositório>Para enviar seus commits para um repositório remoto (por exemplo, GitHub):
git push -u origin mainPara puxar as últimas alterações de um repositório remoto:
git pull origin mainEsses são os comandos básicos que você usará para gerenciar seus projetos com Git.