DEV Community

Roberson Miguel
Roberson Miguel

Posted on

3

Workflow com GIT

Se você procurar sobre qual o melhor a se fazer para manter seus trabalhos atualizados diariamente com o Git, você vai se deparar com git merge versus git rebase.

O que eu pude perceber é que boa parte dos posts falando sobre o assunto seguiam o seguinte workflow:

a) Pegar as novidades da master remota (origin/master)
$ git checkout master
$ git pull — rebase origin master

Obs.: os novos commits locais da master ficariam linearizados

b) Pegar as novidades remotas da sua branch
$ git checkout sua-branch
$ git pull — rebase origin sua-branch

c) Mesclar com rebase a master na sua branch
$ git rebase master

d) Ir comitando e repetindo os passos acima diariamente.
Assim, você vai pegar novidades da master e da sua branch remota.

e) Quando você terminar a funcionalidade/correção, fazer merge da sua branch na master com no-ff pra evitar o fast-forward.
$ git checkout master
$ git merge sua-branch — no-ff

Uma das empresas que propagava esse workflow em seus projetos comerciais era a brasileira Plataformatec comprada pelo Nubank.

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

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay