Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

4uxlab/001-git-comands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

GIT / GIT HUB - Comandos gerais / General commands

🔹Configuração Inicial (Executar uma vez) / Initial Setup (Run once)

⚙️ PT - É sempre um pouco dificil lembrar de codigos do git e do github principalmente para pessoas que estão iniciando. Na tentativa de ajudar compilei abaixo uma lista completa de codigos e claro aceito sugestões.

⚙️ EN - It's always a little difficult to remember Git and GitHub codes, especially for beginners. In an attempt to help, I've compiled a complete list of codes below, and of course, I welcome suggestions.

git config --global user.name "user.name"

Define seu nome para todos os projetos no PC.
Set your name for all projects on your PC.

git config --global user.email "user.email"

Define seu email para todos os projetos no PC.
Set your email address for all projects on your PC.

git config user.name "user.name"

Define seu nome para projeto especifico.
Define your name for a specific project.

git config user.email "user.email"

Define seu email para projeto especifico.
Define your email for a specific project.

git config user.name

Verifica qual nome está configurado no projeto atual.
Check which name is configured in the current project.

git config user.email

Verifica qual email está configurado no projeto atual.
Check which email address is configured in the current project.

git config --global --list

Lista todas as configurações globais.
Lists all global settings.

git --version

Verifica versão do git instalada
Check the installed git version.

ls -al ~/.ssh

Verifica se existe chave ssh cadastrada no computador
Checks if an SSH key is registered on the computer.

ssh-keygen -t ed25519 -C "user.email" -f ~/.ssh/id_ed25519_"nome"

Gerar uma nova chave SSH com descrição especifica
Generate a new SSH key with a specific description.

🔹Comandos de Navegação (Bash/Terminal) / Navigation Commands (Bash/Terminal)

pwd

Mostra o caminho da pasta onde você está agora.
Shows the path to the folder you are currently in.

ls

Lista os arquivos (visíveis) da pasta atual.
Lists the (visible) files in the current folder.

ls -a

Lista todos os arquivos (incluindo ocultos, como .git).
Lists all files (including hidden files, such as .git).

cd "nome.pasta"

Entra na pasta.
Enter the folder.

cd ..

Sai da pasta atual (volta um nível).
Exit the current folder (go back one level).

mkdir "nome.pasta"

Cria uma nova pasta vazia.
Creates a new empty folder.

touch "nome_arquivo.ext"

Cria um arquivo vazio.
Creates an empty file.

ctrl + l

Limpa a tela do terminal (visual).
Clears the terminal screen (visually).

cat "nome_arquivo.ext"

Mostra o conteúdo do arquivo.
Shows the contents of the file.

🔹O Ciclo Básico (Dia a Dia) / The Basic Cycle (Day by Day)

git init

Transforma a pasta atual em um repositório Git.
Transforms the current folder into a Git repository.

git status

O comando mais importante. Mostra o que mudou, o que está no stage, etc.
The most important command. It shows what has changed, what's on the stage, etc.

git add "nome_arquivo.ext"

Prepara um arquivo específico para o próximo commit (Stage).
Prepares a specific file for the next commit (Stage).

git add .

Prepara todos os arquivos alterados/novos para o commit.
Prepares all changed/new files for commit.

git commit -m "mensagem"

Grava o "snapshot" (foto) dos arquivos que estão no Stage.
Records a "snapshot" (photo) of the files that are on the Stage.

git show

mostra os detalhes (diferenças) do último commit.
shows the details (differences) of the last commit.

git log

Mostra o histórico de commits (autor, data, hash).
Displays the commit history (author, date, hash).

git log --oneline

Mostra o histórico resumido (útil para leitura rápida).
Shows a summary of the history (useful for quick reading).

git diff

Mostra as diferenças entre a árvore de trabalho e a área de staging.
Shows the differences between the work tree and the staging area.

git tag

Cria uma tag/versão.
Creates a tag/version.

git blame "nome_arquivo.ext"

Mostra quem alterou cada linha do arquivo.
Shows who modified each line of the file.

🔹Ramificação (Branches) / Branches

git branch

Lista as branches locais. O asterisco (*) indica a atual.
Lists the local branches. The asterisk (*) indicates the current branch.

git branch "nome_branch"

Apenas cria uma branch, mas não muda para ela.
It only creates a branch, but doesn't switch to it.

git switch "nome_branch"

Troca para a branch especificada. (Antigo: git checkout).
Switch to the specified branch. (Old: git checkout).

git switch -c "nome_branch"

Cria e já troca para a nova branch. (Antigo: git checkout -b).
Creates and switches to the new branch. (Old method: git checkout -b).

git push -u origin "nome_branch"

Cria a branch também no github para permissão de commits.
Also create the branch on GitHub to allow commits.

git merge "nome_branch"

Funde a branch especificada na branch atual.
Merge the specified branch into the current branch.

git branch -d "nome_branch"

Deleta uma branch (se já foi mergeada).
Deletes a branch (if it has already been merged).

git branch -D "nome_branch"

Força a deleção de uma branch (mesmo sem merge).
Forces the deletion of a branch (even without a merge).

🔹Sincronização com GitHub (Remoto) / Synchronization with GitHub (Remote)

git clone "url"

Baixa um repositório completo do GitHub para seu PC.
Download a complete GitHub repository to your PC.

git remote add origin "URL"

Conecta seu repositório local a um repositório vazio no GitHub.
Connects your local repository to an empty repository on GitHub.

git remote remove origin

Remove o remoto URL.
Remove the remote URL.

git remote -v

Ver o endereço remoto atual utilizado.
View the currently used remote address.

git remote set-url origin "URL"

Altere o endereço remoto para o repositório correto.
Change the remote address to the correct repository.

git push -u origin main

Envia seus commits locais para o GitHub (primeira vez).
Send your local commits to GitHub (first time).

git push

Envia seus commits para o GitHub (após configurado).
Send your commits to GitHub (after configuration).

git pull

Traz alterações do GitHub para seu PC e faz merge automático.
Brings changes from GitHub to your PC and performs automatic merges.

git fetch

Baixa informações do GitHub mas não altera seus arquivos (seguro).
Downloads information from GitHub but does not modify your files (safe).

🔹Desfazendo Coisas (Cinto de Segurança) / Taking Things Apart (Seat Belt)

git restore "nome_arquivo.ext"

Descarta alterações no arquivo (volta como estava no último commit).
Discards changes to the file (reverts it to its state in the last commit).

git reset "nome_arquivo.ext"

Tira o arquivo do Stage (mas mantem as alterações no arquivo).
Remove the file from the Stage (but keep the changes in the file).

git commit --amend -m "txt"

Corrige a mensagem do último commit (se não foi enviado ainda).
Corrects the message from the last commit (if it hasn't been sent yet).

git stash

Guarda mudanças temporariamente num "bolso" para limpar a área de trabalho.
Temporarily store spare change in a "pocket" to clear your workspace.

git stash pop

Recupera as mudanças guardadas no "bolso".
Retrieve the changes kept in your "pocket".

git checkout "codigo_do_ultimo_commit" "nome_arquivo.ext"

Restaura arquivo deletado a partir do ultimo commit.
Restores deleted files starting from the last commit.

🔺Apagando arquivos, (Perigo) / Deleting files (Danger)

rm nome_"nome_arquivo.ext"

Deletar um arquivo específico do repositório local.
Delete a specific file from the local repository.

rm -i "nome_arquivo.ext"

Deletar um arquivo pedindo confirmação (mais seguro).
Deleting a file and requesting confirmation (more secure).

rmdir "nome_pasta"

Deletar uma pasta vazia.
Delete an empty folder.

rm -r "nome_pasta"

Deletar uma pasta com conteúdo.
Delete a folder containing content.

Espero ter ajudado !
I hope I helped!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published