Coder Social home page Coder Social logo

git-commands's Introduction

Iniciar Versionamento

    echo "# NOME_DO_REPOSITORIO" >> README.md
    git init
    git add README.md
    git commit -m "first commit"
    git branch -M main
    git remote add origin https://github.com/LINK_DO_REPOSITORIO.git
    git push -u origin main
    
    git remote add origin https://github.com/LINK_DO_REPOSITORIO.git
    git branch -M main                             
    git push -u origin main

Comandos Basicos:

    git add .                                  //adiciona todos os arquivos
    git add <nomeDoArquivo>                    //adiciona arquivos especificos

    git commit -m <"nomeDoCommit">             //commitar
    git status                                 //ver status
    git push origin <nomeDaBranch>             //enviar branch ou alterações para o GitHub
    git pull                                   //puxar arquivos do GitHub para sua maquina
    git fetch                                  //buscar todas as alterações da branch remota para a local
    git checkout -- .                          //remover alterações não adicionadas e não commitadas

Git Branch:

    git branch                                   //ver branches
    git branch -a                                //ver branches remotas e locais
    git checkout -b <nomeDaBranch>               //cria uma branch
    git checkout <nomeDaBranch>                  //navega para a branch 'nomeDaBranch'
    git branch -d <nomeDaBranch>                 //deletar branch 'nomeDaBranch'

    git branch -m <nomeAtual> <novoNome>         //mudar nome da branch
    git branch -m <novoNome>                     //mudar o nome quando vc esta na branch

    git merge <nomeDaBranch>                     //juntar as branches  
    git branch -M "main"                         //mudar branch para main
    git push origin <nomeDaBranch>               //subir a nova branch para o GitHub

Clonar Repositorios:

    git clone <[email protected]>

Git Stash:

    git stash save <"nomeDoStash">               //guardar conteudo de forma temporaria
    git stash list                               //ver a lista do stash, guardado em vetores
    git stash pop <indiceDoVetor>                //pegar conteúdo do stash de volta
    git stash clear                              //limpar stash

Git Log:

    git log                                      //ver historico de commits
    git log --oneline                            //historico em uma linha 
    git log --graph                              //historico em formato de grafico    

Git Reset:

    git reset <HEART~1>                          //voltar para ultimo commit HEART~2 HEART~3 
    git reset <id do commit>                     //passar o id do commit como parametro

Git Revert:

    git revert <cha1>                            //voltar para o commit 

Chaves

    --Artigo Com Todas As Informações Chave SSH
    https://docs.github.com/pt/authentication/connecting-to-github-with-ssh


    ssh-keygen -t rsa -b 4096 -C "[email protected]"    //Gerar chave
    eval "$(ssh-agent -s)"                                  //Ativar gerenciador de chaves
    ssh-add ~/.ssh/id_rsa                                   //Adicionar a chave


    --Copiar chave 
    pbcopy < ~/.ssh/id_rsa.pub                              //mac
    cat ~/.ssh/id_rsa.pub                                   //outro
    xclip -sel clip < ~/.ssh/id_rsa.pub                     //linux

    git config --global user.name "Seu Nome"                //Name config
    git config --global user.email "[email protected]"  //Email config

git-commands's People

Contributors

gabrielrossi-gr avatar

Stargazers

Pedro Franco avatar  avatar

Watchers

 avatar

Forkers

lpavarini

git-commands's Issues

bug report

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Feature request

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

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.