Skip to content

Instantly share code, notes, and snippets.

@fernandojunior
Last active January 14, 2016 04:50
Show Gist options
  • Save fernandojunior/31d86c231dfb2363db4f to your computer and use it in GitHub Desktop.
Save fernandojunior/31d86c231dfb2363db4f to your computer and use it in GitHub Desktop.
comandos git
# instalacao no ubuntu
apt-get install git
# iniciar git no diretorio
git init
# relaciona um repositorio remoto ao diretorio "origin"
git remote add origin git@github.com:account/repository_name.git
# puxa a branch "master" do repositorio para o diretorio "origin"
git pull origin master
# indica adicao, ou alteracao de um arquivo no diretorio
git add arquivo.txt
# indica adicao, ou alteracao de todos os arquivos no diretorio
git add .
# to stage your whole working tree
git add -u :/
# to stage just the current path
git add -u .
# alteracoes a serem comitadas
git status
# comita as alteracoes para o repositorio local
git commit -m "comentario"
# empurra o comite do diretorio "origin" para a branch "master" do repositorio remoto
git push origin master
# atualiza o diretorio "origin"
git fetch origin
# lista de branches
git branch
# cria uma branch com nome "name"
git branch name
# troca de branch
git checkout name
# merge entre branches
git merge name
# para manter o arquivo em sua árvore e então ignora-lo.
git rm --cached <file>
# remove um branch
git branch -d branchname # local
git push origin :branchname # remoto
# cria tag anotada
git tag -a v1.4 -m "my version 1.4" # annotated
git tag v1.4-lw # lightweight
# remove uma tag
git tag -d tagname # local
git push origin :refs/tags/tagname # remoto
# referencias
# http://codexico.com.br/blog/linux/tutorial-simples-como-usar-o-git-e-o-github/
# https://help.github.com/articles/generating-ssh-keys/
# https://help.github.com/articles/which-remote-url-should-i-use/#cloning-with-ssh
# http://www.ralfebert.de/tutorials/git/
# https://www.digitalocean.com/community/tutorials/how-to-install-git-on-ubuntu-14-04
# http://pt-br.gitready.com/iniciante/2009/01/19/ignoring-files.html
# http://git-scm.com/book/en/v2/Git-Basics-Tagging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment