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?
GitHub is a for-profit company that offers a cloud-based Git repository hosting service. Essentially, it makes it a lot easier for individuals and teams to use Git for version control and collaboration. GitHub's interface is user-friendly enough so even novice coders can take advantage of Git.
Lets say your co-worker merged his code to production
branch.
Now the branch yourfeature
you created from earlier production
is outdated a bit and has few commits by you on top of it.
What you have to do now is :
production
branchyourfeature
branchproduction
: This will replay your commits of this branch over the latest production. Read more on rebasing here
Well, you could checkout the branch you wish to merge into,
git checkout master
then merge your code
git merge [current_branch]
There is always the possibility of conflicts and in that case you simply have to deal with them and resolve them.
This article should help: http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With