Answer the question
In order to leave comments, you need to log in
Started working in the wrong thread again?
Given:
master
branch develop branch
all changes must go through develop and then merge with master
Task:
1. How to organize yourself before starting work, always check the current branch?
2. Why do you often make changes, and then you realize that this is the master branch, and not develop?
PS
master is deployed to the production server
develop into a test sandbox - it is reviewed and approved by the client
Answer the question
In order to leave comments, you need to log in
1. Finishing work, glue a sticker in the middle of the monitor - Start work with pull.
2. Because carelessness. But in most cases, there is no problem then moving the commits to the correct branch.
Close the push master, merge only through pull requests.
Use processes for team work. Even if you don’t work in a team yet, you need to accustom yourself to this, then everything will be much easier, and you won’t suffer with merges. There is a translated article with rules: https://habr.com/post/106912/. If you want, contact me, I'll show you how it works for me.
And... if you haven't managed to commit to the master yet, but only made changes, you can switch to the development without any problems, and commit already in it, you don't need to do any extra commands. By the way, this is also a solution - just train yourself before any commit (and in general in every incomprehensible situation with git) to do git status and see if you are on the right branch.
Before starting work on a new task
git checkout master
git pull
git checkout -b task_number_and_task_name
It looks like it's even harder to remember, until you imagine that a hundred conditional developers could already push a bunch of code into the master, and there's a bunch of code on the develop branch that for three years but he was not approved as a master.
Then you will work every time on a new task in a new branch. Then you will merge this branch into develop to demonstrate your task. And then if everything is OK, then merge your branch (not develop) into the master (or throw a merge request
)
And yes, preferably three servers. Demo, stage and prod.
The demo contains a garbage develop branch. The stage contains the master branch. And prod is also a master branch. The good work of your task in the trash branch does not guarantee that in the master
1. Set develop as master branch, in repository settings
2. Use Soource Tree with gitflow schema out of the box, you will work through the operation menu: start patch - end patch, start topic branch - end topic branch, and so on. All checks and routine operations will be taken over by gitflow.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question