Introduction to GitLab terms
Branches: active, stale, default, protected
Under the branch page, there are active
two stale
kinds of branches, and for the initially created branch, there are default
labels protected
. As shown below:
· Active branch (Active Branch)
: The active branch is the branch where development work is currently taking place. When you switch to a branch in IDEA and start developing on that branch, that branch is considered the active branch.
Stale branch (Stale Branch)
: A stale branch is a branch that is no longer frequently modified during development. A branch may be considered stale when its code has been merged into other branches or projects, or has not been updated in a long period of time.
· Default branch (Default Branch)
: Default branch refers to the main branch that is automatically created when the code base is created. Usually, the name of this branch is "master" or "main". The default branch is considered the most important development branch in some cases and occupies an important position in the project.
· Protected branch (Protected Branch)
: A protected branch refers to a branch that is restricted by special permissions and protection mechanisms. Typically, protected branches are used to store stable or production code, and only specific developers or teams have permission to modify or merge them.
git panel in IDEA: local, remote, HEAD
In the git panel in IDEA, there are local, remote, and HEAD. As shown below:
Local (Local): Local refers to the development environment you are currently using, usually your personal computer or development machine. In IDEA, local refers to your local copy of the codebase, which you can modify, add to, and delete from.
Remote: Remote refers to a copy of a code base different from the local one, usually a code base stored on a remote server, such as a Git repository. Remote code repositories can be used collaboratively by multiple developers and allow for version control and code exchange.
· HEAD: HEAD is a special pointer in Git that points to the latest commit in the current branch. In IDEA, HEAD represents the latest commit of the selected branch in the current working directory. You can think of HEAD as a snapshot of the current state of your codebase to compare, roll back, or review changes.
local is the copy of the code base in the development environment you are using, remote is the copy of the code base stored on the remote server, and HEAD is a pointer to the latest commit of the current branch. IDEA provides convenient development and version control functions by integrating these concepts.
Options when merging: Delete, squash
When submitting a merge in GitLab, there are options: Delete
, squash
. As shown below:
· Delete: This option means to delete the merged branch after the merge is complete. When you select this option, the merged branch is completely deleted and no longer exists in the code base. Usually, this option is suitable when you no longer need to keep the history of the branch being merged, or the code of this branch has been fully integrated into the target branch.
· Squash (compression): This option means that multiple submissions (commits) of the merged branch will be compressed into a single submission. When you select this option, each commit of the merged branch will be merged into a single commit and applied to the target branch. This keeps the commit history of the target branch more succinct without being overly detailed.