Example:
-
I cloned the Github repository, created a new branch and started working on a feature.
-
My co-worker clones the same exact Github repository, creates his own branch on his local machine (git checkout -b mylocalbranch), and works on his own feature.
-
My co-worker finishes his feature before I do and pushes it to production and back to Github.
-
I finish my feature 30 minutes later and want to push my work without causing any conflicts.
What is the best way to push my work to production and back to Github without causing any conflicts?
Lets say your co-worker merged his code to
productionbranch.Now the branch
yourfeatureyou created from earlierproductionis outdated a bit and has few commits by you on top of it.What you have to do now is :
productionbranchyourfeaturebranchproduction: This will replay your commits of this branch over the latest production.Read more on rebasing here