Answer the question
In order to leave comments, you need to log in
How to properly organize work with git?
We have one repository and one project deployed locally.
1) I made a commit commit1, deployed the changes in staging to the server (for example, to show the manager, not the programmer).
2) The manager said well, but something else needs to be done, a completely different functionality. And commit1 is not yet deployed to staging.
3) I make commit2 to the repository, again deploy to staging.
Everything is fine, you need to deploy in production. But the repository already has a commit1 that cannot be deployed to production, so I manually return the old code in these files and only then deploy commit2 changes to production.
How to organize work in this case?
Answer the question
In order to leave comments, you need to log in
If you were immediately told that commit1 is not needed (but you need to save it for now), then it’s easier to create a new branch on commit2
Remove a commit -- do a revert
It is better to do this whole thing through an IDE (for example, PHPSTORM) or through GitKraken, for example
Your these commit1 and commit2 should be in different branches, and neither of them, in a good way, should be in the master.
They will get into master just after the features are ready (or even already tested on the stage).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question