Code Monkey home page Code Monkey logo

git-ultimate-cheatsheet's Introduction

Content

Config

Configura o nome de usuário

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

Configura o email de usuário

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

Retorna o nome de usuário configurado

git config user.name

Lista todas as configurações do seu git

git config --list

Log

Mostra todos os commits feitos.

git log

Mostra os commits de uma forma simplificada

git log --oneline

Mostra só os commits feitos pelo o autor informado

git log --author="nome"

Ordena os commits por autor, mostrando o que cada um fez

git shortlog

Mostra informações sobre um commit especifico

git show <hash>

Retorna o head e outras informações sobre cada commit

git reflog

Commit

Adiciona o arquivo em staged

git add <caminho-arquivo>

Adiciona todos os arquivos em staged

git add .

Cria um commit

git commit  -m "mensagem"

Altera a mensagem do último commit

git commit --amend -m "nova mensagem"

Sobrescreve o último commit, utilizando a mesma mensagem

git commit --amend --no-edit

Branch

Cria uma branch

git branch <nome-branch>

Remove a branch

git branch -D <nome-branch>

Renomeia uma branch

git branch -m <old_name> <new_name>

Lista todas as branchs

git branch

Faz checkout para uma branch

git checkout <nome-branch>

Cria uma nova branch e faz checkout

git checkout -b <minha-nova-brach>

Rebase

Sincroniza uma branch com outra

git rebase <nome-branch>

Continua o processo de rebase

git rebase --continue

Inicializa o rebase interativo

git rebase -i <hash>

Continua o processo de rebase

git rebase --continue

Tag

Cria uma tag

git tag <v1.0.0>

Cria uma tag com mensagem

git tag -a <1.0.0> -m "mensagem"

Remove tag local

git tag -d <v1.0.0>

Remove tag do remote

git push --delete origin <tag_name>

Faz checkout para o momento que a tag foi criada

git checkhout <tag>

Stash

Salva as alterações na memoria

git stash

Lista todos os stash

git stash list

Carrega o stash selecionado

git stash apply <ref>

Carrega e remove o último stash

git stash pop

Remove o stash com o ref informado

git stash drop <ref>

Remove todos os stashs salvos

git stash clear

Reset

Desfaz as alterações do commit do hash, deixando os arquivos em staged

git reset <hash>

Desfaz as alterações do commit do hash, deixando os arquivos como not staged

git reset --mixed <hash>

Desfaz o commit e tudo que foi feito

git reset --hard <hash>

Remove o arquivo do staged

git reset src/example.ts

Remote

Retorna a lista de remote

git remote

Mostra informações sobre o remote

git remote -v

Adiciona remote

git remote add <nome-remote> <URL>

Remove remote

git remote rm <nome-remote> 

Faz push da branch para o remote

git push origin <nome-branch>

Envia todas as branchs para o remote

git push origin --all

Lista todas as branchs disponíveis no remote

git branch -a

Puxa novas atualizações da branch do remote, utilizando rebase

git pull origin <nome-branch> --rebase

Exclui branch do remote

git push origin --delete <nome-branch>

Envia as tags para o remote

git push origin main --tags

Bônus

Pega um commit de uma branch

git cherry-pick <hash>

Desfaz o último commit

git reset HEAD~1

Volta para a última branch

git checkout -

Clona um repositório

git clone <URL>

git-ultimate-cheatsheet's People

Contributors

d3vlopes avatar

Stargazers

Alex Holanda avatar Bruno Roberto Flores da Cunha avatar Helton Quintãns avatar Jhon G. avatar Douglas avatar Maicoln Pereira de Sousa avatar Willian Kennedy avatar

Watchers

 avatar

Forkers

sociavel

git-ultimate-cheatsheet's Issues

Adjust in tag command

Hi Bro, the sheet is very good! Only have a point that I notice, in Tag Commands have a error type in command git checkhout

Thanks for sharing your knowledge with community :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.