Theory_Theory
Theory_Theory

Reputation: 51

Git merge first or git push first?

which one is the best way?

On develop branch:

1)

2)

Upvotes: 1

Views: 240

Answers (1)

VonC
VonC

Reputation: 1329542

A code review is not supposed to take place on the target branch (in your case "develop"), only on the source branch, rebased first on top of the target branch.

The idea of a code review is to allow the final merge only if the CR passes.
If the review rejects the commit, no merge.

So:

git fetch
git switch feature
git rebase origin/develop
# resolve conflicts, test everything
git push --force-if-includes 
# request a review before merge, through for instance a pull request

(On --force-if-includes, see this answer)

If you are several to work on feature branch, do communicate when you rebase the branch, as it will change its history, and your colleagues will have to reset their local feature branch to the new origin/feature forced pushed one.

Upvotes: 1

Related Questions