many conflicts
Whoops. You messed up.
I'm so sorry for you.
Live and learn.
Perhaps next time y'all will do better.
Ground rules: You do have automated tests, right?
And they run Green. Good, we can proceed.
During sprint planning you should have coordinated
the efforts of various developers.
This is the principle means of avoiding conflicts.
It takes practice, and by now you've had more
practice than before, you've seen places where
things can go south.
Then during
PR
the affected people should have had an opportunity
to notice potential conflicts and coordinate.
But we're past that now, as your buddy has
merged to develop
and you're trying to close
out the sprint.
Imagine you spent a few days writing source code
or a PPT deck, and then your laptop caught fire
and you bought a new one. Is the work "lost"?
Yes. Would it take you days to reproduce similar work?
No, because you learned things during those days.
Now, let's close out that sprint.
Preserve your current branch. Definitely push
it so the git server has a copy. Often I will
put a copy in /tmp
.
Now, pretend your laptop caught fire.
Checkout a fresh develop
that has your
colleague's code in it.
Invent a new branch name and make a brand new feature branch.
Verify that tests run Green.
Now, you need to write your feature
on top of this existing code.
Fortunately, you already know how to do this.
Plus, you can refer to stored code,
and copy-n-paste it into this new branch.
Produce some code, and verify it runs Green.
Do a final WIP commit, and push branch to server.
Do one last $ git pull develop
,
just to verify you're still in sync. Good!
Now submit a PR to your colleagues, await approval,
and do a clean merge in the usual way. Done.
(we're using Git Flow)
Ummm, with all due respect, no, you're not.
Adhering to that approach would have prevented the current conflict.
Going forward, prefer to integrate fresh code from colleagues
via the integration branch. The name of the integration
branch is usually develop
, or in some projects main
. Merge edits up to it,
and pull edits down from it.
And do verify that tests in CI/CD run Green before attempting such steps.