Answer the question
In order to leave comments, you need to log in
Create a new branch, am I correct in my idea of what needs to be done?
I'm sorry, the question seems to be elementary. But I am an inexperienced person, I need confirmation that I understand the matter correctly.
Typical situation at work.
There is a master branch master ; there is my development branch called let's say dev .
I have a certain task, I start working on it in the dev branch - I work on some block of code A. In the process of work, my changes somehow break our application, our product - but it's okay, I'm still debugging, I'm in the process , all right.
Here the boss comes running and says that we urgently need to change something else, some block of code B.
I (remaining in the dev branch) I begin to feverishly comment or otherwise neutralize the changes in code block A - so that the work of the product is restored. Then I make the required changes to code block B. Then everything is done, git push, and you can return to code block A.
Intuition tells. that this is not the right way to live, and in fact you need to create some third branch, let's call it fast , that would branch directly from master (i.e. it would not have the breakages that I introduced in code block A).
Then we work in fast , commit-push, go back to dev , work on code block A next.
Actually, the question is whether I correctly imagine the steps that need to be performed in order to do all this correctly.
So, I see the matter as follows (we are sitting in dev , the boss came running):
( dev )
1. git add, git commit
(The question immediately arises, is this necessary, because I don’t have my block A yet. But like git somehow protests if you leave the branch without committing)
( dev )
2.
git checkout master
( master )
3. git checkout
-b fast
, made code block B.
(fast)
4. git add, git commit, git checkout master
(master)
5. git pull
(Here we can still receive changes to the master from a remote repository)
(master)
6. git merge fast, git push
(master) 7. git
checkout dev (
dev)
8. git rebase
master that there are no conflicts
Answer the question
In order to leave comments, you need to log in
https://www.atlassian.com/ru/git/tutorials/saving-...
Temporarily saving the code
After that, make a branch based on dev
Make changes and after the test, do a merge or rebase
Then return to the changes saved at the beginning
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question