Introduction to GitLab Flow | GitLab - 0 views
-
GitLab flow as a clearly defined set of best practices. It combines feature-driven development and feature branches with issue tracking.
-
In Git, you add files from the working copy to the staging area. After that, you commit them to your local repo. The third step is pushing to a shared remote repository.
- ...68 more annotations...
-
Nowadays, most organizations practice continuous delivery, which means that your default branch can be deployed.
-
Continuous delivery removes the need for hotfix and release branches, including all the ceremony they introduce.
-
Merging everything into the master branch and frequently deploying means you minimize the amount of unreleased code, which is in line with lean and continuous delivery best practices.
-
You can deploy a new version by merging master into the production branch. If you need to know what code is in production, you can just checkout the production branch to see.
-
To deploy to pre-production, create a merge request from the master branch to the pre-production branch.
-
Tools such as GitHub and Bitbucket choose the name “pull request” since the first manual action is to pull the feature branch.
-
Tools such as GitLab and others choose the name “merge request” since the final action is to merge the feature branch.
-
If you work on a feature branch for more than a few hours, it is good to share the intermediate result with the rest of the team.
-
If the assigned person does not feel comfortable, they can request more changes or close the merge request without merging.
-
In GitLab, it is common to protect the long-lived branches, e.g., the master branch, so that most developers can’t modify them.
-
if you want to merge into a protected branch, assign your merge request to someone with maintainer permissions.
-
Having a reason for every code change helps to inform the rest of the team and to keep the scope of a feature branch small.
-
For example, the issue title “As an administrator, I want to remove users without receiving an error” is better than “Admin can’t remove users.”
-
If you open the merge request but do not assign it to anyone, it is a “Work In Progress” merge request.
-
Start the title of the merge request with [WIP] or WIP: to prevent it from being merged before it’s ready.
-
When they press the merge button, GitLab merges the code and creates a merge commit that makes this event easily visible later on.
-
Merge requests always create a merge commit, even when the branch could be merged without one. This merge strategy is called “no fast-forward” in Git.
-
Suppose that a branch is merged but a problem occurs and the issue is reopened. In this case, it is no problem to reuse the same branch name since the first branch was deleted when it was merged.
-
If you have an issue that spans across multiple repositories, create an issue for each repository and link all issues to a parent issue.
-
Rebasing creates new commits for all your changes, which can cause confusion because the same change would have multiple identifiers.
-
if someone has already reviewed your code, rebasing makes it hard to tell what changed since the last review.
-
Often, people avoid merge commits by just using rebase to reorder their commits after the commits on the master branch.
-
Using rebase prevents a merge commit when merging master into your feature branch, and it creates a neat linear history.
-
Sometimes you can reuse recorded resolutions (rerere), but merging is better since you only have to resolve conflicts once.
-
A good way to prevent creating many merge commits is to not frequently merge master into the feature branch.
-
If your feature branches often take more than a day of work, try to split your features into smaller units of work.
-
You could also use feature toggles to hide incomplete features so you can still merge back into master every day.
-
If you rebase code, the history is incorrect, and there is no way for tools to remedy this because they can’t deal with changing commit identifiers
-
If new commits in master cause merge conflicts with the feature branch, merge master back into the branch to make the CI server re-run the tests.