Initialize a projet
- Create a new projet in gitlab a take note of its url
Protecting the master branch
On the gitlab page of your project go to Settings/Repository in the Protected Branches section.
Select the Master branch and set allow to merge to Masters and allow to push to No one
This will prevent anyone to push on the master branch, the only way to add code to the branch will be using merge requests.
Setting the development branch
- Retrieve the project on your computer, open a command line and execute.
git clone <your-project-url>
- Create the development branch
git checkout -b development
- Init your Angular, Nest or any other project and then any time you want to commit changes
git add .
git commit -m "Commit changes"
git push origin development
Start developments
For any other development you should/must create branch from the development branch.
First make sure to be on the development branch, you can use to see your current branch:
git branch
Working on a feature
In our team organisation we are using IceScrum to keep track of our User Stories (US). Each US is identified by a number. In order to easily identify the commit that includes the US a branch name for a feature should be has a following feature-<number of the User Story>-<title_of_the_user_story>.
You can create the branch executing:
git checkout -b feature-<number of the User Story>-<title_of_the_user_story>
Working on a bug fix
Each bugfix branch should be named as the following bugfix-<title_of_the_bugfix>.
You can create the branch executing:
git checkout -b feature-<number of the User Story>-<title_of_the_user_story>
add tag git tag -a 1.0.0 -m "complementary message"