Last active
April 4, 2025 17:39
-
-
Save edinella/413f8f0b83a4b07dc5cb91f285dea089 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Crie a branch de correção e troque para ela | |
git checkout -b fix/whatever | |
# 2. Faça as alterações, veja as diferenças, adicione e confirme | |
git diff | |
git add . | |
git commit -m "fix: corrige problema XYZ" | |
# 3. Envie a branch para o remoto e defina o upstream | |
git push -u origin fix/whatever | |
# 4. Use "checkout -" para voltar rapidamente à branch anterior (geralmente a main) | |
git checkout - | |
# 5. Atualize a branch base (ex: main) com rebase | |
git pull --rebase origin main | |
# 6. Retorne para a branch de correção com "checkout -" | |
git checkout - | |
# 7. Rebase sua branch de correção sobre a main atualizada | |
git rebase main | |
# 8. Se ocorrerem conflitos, utilize o mergetool, adicione as correções e continue o rebase | |
git mergetool # opcional: abre uma ferramenta para resolução de conflitos | |
git add . # após resolver cada conflito | |
git rebase --continue | |
# 9. Por fim, force o push da branch atual (HEAD aponta para a branch ativa) | |
git push --force-with-lease origin HEAD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment