Skip to content

Instantly share code, notes, and snippets.

@savio777
Created May 31, 2023 00:10
Show Gist options
  • Save savio777/61204c3fb023719fd20e30456e7ca42e to your computer and use it in GitHub Desktop.
Save savio777/61204c3fb023719fd20e30456e7ca42e to your computer and use it in GitHub Desktop.
git

git

  • renomear mensagem do último commit:
git commit --amend -m "New commit message."
  • reverter commit:
git reset HEAD~
  • deletar branch localmente:
git branch -d <branch_name>
  • deletar branch remotamente:
git push origin --delete <branch_name>
  • correção ultimo commit
git commit --amend
  • mostrar URL remoto atual:
 git remote -v
  • mudar URL remoto:
git remote set-url <remote_name> <remote_url>

example:

git remote set-url origin https://git-repo/new-repository.git
  • adicionar a chave ao ssh-agent (Mac ou Linux)
eval $(ssh-agent)
ssh-add ~/.ssh/<private_key_file>
  • exemplo url remoto requisição https que não precisa passar a senha sempre:
git remote set-url origin https://<user>:<password>@git-repo/new-repository.git
  • correção erro ao fazer PULL: fatal: Not possible to fast-forward, aborting.
git pull --no-ff
  • padrão de commits:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment