In the company I work for, the developer is pushing the local feature branch after changes locally committed, to the remote repository. Then after the code review, the feature branch is merged into master (the remote master).
My question is:
What if the local master and the remote master not in sync? Then the branch is merged into a completely different project? For example, I git cloned master 2 weeks ago + branched from it to a new feature branch, but in these two weeks, changes have been made to the master. So my worry is that my feature branch will be merged into totally different master branch! Without me testing it first.
Question: isn't a smarter workflow would be to before pushing the feature branch to remote repository and pull request to first:
git checkout master
git pull
git checkout my-feature-branch
git merge master (now i know my branch is in sync with master. Resolve conflicts locally)
and only then:
git checkout my-feature-branch
git push origin my-feature-branch?
The flow I've seen being employed in several companies (successfully) is as follows:
References:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.