DEV Community

Wesley Rodrigues
Wesley Rodrigues

Posted on • Edited on

Como enviar somente novos commits em uma branch que já foi mesclada.

Ao trabalhar no desenvolvimento de software é normal ter alguns problemas para subir nosso código para codebase, neste artigo vou deixar uma dica de como enviar somente os novos commits que você fez em uma determinada branch que já foi mesclada em outra.

Nesse caso você pode ajustar seu Pull Request para conter apenas seus novos commits fazendo o seguinte:

  1. Navegue e atualize sua branch local:
git checkout main  # branch em que mesclou seu Pull Request
git pull origin main  
Enter fullscreen mode Exit fullscreen mode
  1. Volte para sua branch em que criou seu Pull Request:
git checkout minha-branch
Enter fullscreen mode Exit fullscreen mode
  1. Faça o rebase:
git rebase main
Enter fullscreen mode Exit fullscreen mode
  1. Force o push:
git push --force
Enter fullscreen mode Exit fullscreen mode

E pronto sua branch de Pull Request vai trazer somente os novos commits que ainda não foram mesclados na sua branch principal.

Top comments (0)

AWS Q Developer image

Your AI Code Assistant

Generate and update README files, create data-flow diagrams, and keep your project fully documented. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Instrument, monitor, fix: a hands-on debugging session

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️