I'm starting to learn Git, which, so far, is great. I'm just confused on one area, this could just be a misunderstanding.
Suppose that John is working in the "john" directory and Bob is working in the "bob" directory.
If John's code isn't the final item we desire for the "john" directory and Bob pulls from the dev branch, Bob will get all of John's "bad" code, correct?
So, Bob applies a simple fix to the "bob" directory and pushes to the production branch. Doesn't John's bad code in the "john" directory sneak onto the production branch through Bob's push?
Does this even happen? How is this avoided?
Gracias a todos!
preguntado el 03 de mayo de 12 a las 20:05
There's a distinction between pushing dev -> production and committing a fix to the production branch directly. The latter is safe for bob.
The only way to know code is safe is to test it before pushing it. This could be a QA team, regression/unit tests, etc.
You usually will not commit "broken code" into
develop o el
master (that are the common names). The
develop branch is usually for code "that should work",
master is for "stable code" (something like
trunk in svn). If you want to create something new, create a new branch for it, for example
feature/myFeature. Now everybody knows, that this code may, or may not be complete and will usually avoid to merge it into their own branch. Once you are done ("it should work"), merge it back into
However, even if you scenario happens, git will recognize, that this bad code is already part of
develop, and will not apply it again.