Repository

Arepositoryis what you use to store your codebase in GitLab and change it with version control. A repository is part of aproject, which has a lot of other features.

Create a repository

To create a new repository, all you need to do iscreate a new project.

Once you create a new project, you can add new files via UI (read the section below) or via command line. To add files from the command line, follow the instructions that will be presented on the screen when you create a new project, or read through them in thecommand line basicsdocumentation.

Important:For security reasons, when using the command line, we strongly recommend that youconnect with GitLab via SSH.

Files

Create and edit files

Host your codebase in GitLab repositories by pushing your files to GitLab. You can either use the user interface (UI), or connect your local computer with GitLabthrough the command line.

To configureGitLab CI/CDto build, test, and deploy you code, add a file called.gitlab-ci.ymlto your repository's root.

From the user interface:

GitLab's UI allows you to perform lots of Git commands without having to touch the command line. Even if you use the command line regularly, sometimes it's easier to do sovia GitLab UI:

From the command line:

To get started with the command line, please read through thecommand line basics documentation.

Find files

Use GitLab'sfile finderto search for files in a repository.

Jupyter Notebook files

Introducedin GitLab 9.1

JupyterNotebook (previously IPython Notebook) files are used for interactive computing in many fields and contain a complete record of the user's sessions and include code, narrative text, equations and rich output.

When added to a repository, Jupyter Notebooks with a.ipynbextension will be rendered to HTML when viewed.

Jupyter Notebook Rich Output

Interactive features, including JavaScript plots, will not work when viewed in GitLab.

Branches

When you submit changes in a newbranch, you create a new version of that project's file tree. Your branch contains all the changes you are presenting, which are detected by Git line by line.

To continue your workflow, once you pushed your changes to a new branch, you can create amerge request, perform inline code review, anddiscussyour implementation with your team. You can live preview changes submitted to a new branch withReview Apps.

WithGitLab Starter, you can also requestapprovalfrom your managers.

To create, delete, andbranchesvia GitLab's UI:

Alternatively, you can use thecommand line.

To learn more about branching strategies read through theGitLab Flowdocumentation.

Commits

When youcommit your changes, you are introducing those changes to your branch. Via command line, you can commit multiple times before pushing.

  • Commit message:A commit message is important to identity what is being changed and, more importantly, why. In GitLab, you can add keywords to the commit message that will perform one of the actions below:
    • Trigger a GitLab CI/CD pipeline:If you have your project configured withGitLab CI/CD, you will trigger a pipeline per push, not per commit.
    • Skip pipelines:You can add to you commit message the keyword[ci skip]and GitLab CI will skip that pipeline.
    • Cross-link issues and merge requests:Cross-linkingis great to keep track of what's is somehow related in your workflow. If you mention an issue or a merge request in a commit message, they will be shown on their respective thread.
  • Cherry-pick a commit:In GitLab, you cancherry-pick a commitright from the UI.
  • Revert a commit:Easilyrevert a commitfrom the UI to a selected branch.
  • Sign a commit:Use GPG tosign your commits.

Repository size

On GitLab.com, yourrepository size limit is 10GB(including LFS). For other instances, the repository size is limited by your system administrators.

You can alsoreduce a repository size using Git.

Contributors

All the contributors to your codebase are displayed under your project'sSettings > Contributors.

They are ordered from the collaborator with the greatest number of commits to the fewest, and displayed on a nice graph:

contributors to code

Repository graph

Git存储库图直观地显示弗洛w strategy used in that repository:

repository Git flow

Find it under your project'sRepository > Graph.

Compare

Select branches to compare and view the changes inline:

compare branches

Find it under your project'sRepository > Compare.

Locked files

Available inGitLab Premium.

Lock your files to prevent any conflicting changes.

File Lockingis available only inGitLab Premium.

Repository's API

You can access your repos viarepository API.

Baidu
map