====== GIT ======
===== Sobre o GIT =====
[[wppt>Git|Wikipedia:Git]]
===== Bloquear push no master =====
[[https://www.google.com.br/search?q=git+prevent+push+to+master&oq=git+block+push+to+master&aqs=chrome.2.69i57j0l3.7324j0j7&sourceid=chrome&es_sm=0&ie=UTF-8|Google]]\\
[[http://stackoverflow.com/questions/19021978/git-how-to-block-push-to-master-branch-on-remote]]\\
[[http://dev.ghost.org/prevent-master-push/]]
#!/bin/bash
protected_branch='master'
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
if [ $protected_branch = $current_branch ]
then
read -p "You're about to push master, is that what you intended? [y|n] " -n 1 -r < /dev/tty
echo
if echo $REPLY | grep -E '^[Yy]$' > /dev/null
then
exit 0 # push will execute
fi
exit 1 # push will not execute
else
exit 0 # push will execute
fi
chmod +x pre-push
===== Programa para utilizar o git localmente =====
[[http://git-scm.com/downloads|Git Bash]]
===== Clone =====
==== Criar um clone de um projeto do repositório para seu ambiente de desenvolvimento ====
''git clone ssh:%%//%%****@****:****/**** ____''\\
**ou**\\
''git clone ssh:%%//%%****@****:****/****''\\
==== Clone de um Branch existente ====
''git clone -b **** ____''
===== Commit =====
==== Commit com arquivos modificados ====
''git commit -a -m "**texto/descrição do commit**"''
==== Simples commit ====
''git commit -m "**texto/descrição do commit**"''
==== Adicionar arquivo para commit ====
''git add **diretório/nome_do_arquivo**''
===== Branch =====
==== Lista branch's ====
Lista todos os branch's e mostra em qual branch você está atualmente\\
''git branch''
==== Criar novo branch ====
Cria um novo branch e faz **checkout** automaticamente para este novo branch\\
''git branch ____''
==== Criar um novo branch no repositório remoto ====
''git push -u origin ____''
==== Apagar um branch local ====
Para apagar um branch você tem que sair dele fazer **checkout** em outro branch para poder apagar ele\\
''git branch -d ____''
==== Navegar entre os branch ====
''git checkout ''
===== Push =====
Publica no repositório remoto\\
''git push **origin** ____''
===== Pull =====
Pega modificações existentes no repositório ____\\
''git pull''
===== Merge =====
Faz a união de ____ ou ____\\
''git merge ____''
===== Diff =====
''git diff''
===== Status =====
''git status''
===== Log =====
''git log''
===== Manipulação de arquivos =====
==== Reset ====
''git reset ____''
==== Checkout ====
''git checkout ____''