Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Destructive Git Commits?

Tags:

git

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?

Thank you all!

like image 574
Oliver I Avatar asked Mar 23 '26 02:03

Oliver I


1 Answers

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.

like image 117
Lucas Holt Avatar answered Mar 25 '26 17:03

Lucas Holt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!