- Learn about Git
- Begin using Git
- Learn more complex commands
- Learn branching and workflow strategies
- Learn advanced topics in Git management
- Related topics
Git
Git is a free and open source distributed version control system. It handles projects of all sizes quickly and efficiently, while providing support for rolling back changes when needed.
GitLab is built on top of (and with) Git, and provides you a Git-based, fully-integrated platform for software development. GitLab adds many powerful features on top of Git to enhance your workflow.
These resources can help you to get the best from using Git with GitLab.
Learn about Git
New to Git? These resources can help you understand basic Git concepts before you dive in:
- Git concepts
- Video tutorial: Git-ing started with Git
- PDF download: GitLab Git Cheat Sheet
The official Git documentation also offers information on Git basics.
Begin using Git
After you learn how Git works, you’re ready to try it out. These resources are appropriate for when you’re ready to start learning Git by doing:
- How to install Git
- Start using Git on the command line
- Tutorial: Make your first Git commit
- Tutorial: How to update Git commit messages
- The GitLab CLI
A typical Git user encounters these concepts soon after starting to use Git:
-
git add
to start tracking files with Git. - Tags and branches.
-
How to undo mistakes,
including
git reset
. - View a chronological list of changes to a file with Git history.
- View a line-by-line editing history of a file with
git blame
. - Sign commits for increased accountability and trust.
Learn more complex commands
When you’re comfortable with basic Git commands, you’re ready to dive into the more complex features of Git. These commands aren’t required when creating straightforward changes. When you begin managing multiple branches or need more complex change management, you’re ready for these features:
- To stop tracking changes to a file, because you don’t want to commit them, unstage the changes.
- Stash your changes when your current work isn’t ready to create a commit locally, but you need to switch branches to work on something else.
- If you create many small commits locally, you can use squash and merge to combine them into fewer commits before pushing them.
- Cherry-pick the contents of a commit from one branch to another.
- Revert an existing commit if it contains changes you no longer want.
Learn branching and workflow strategies
When you’re comfortable with the creation and handling of individual branches, you’re ready to learn about Git workflows and branching strategies:
- Feature branch workflow
- Introduction to Git rebase, force-push, and merge conflicts
- From the official Git documentation:
Learn advanced topics in Git management
Git and GitLab, combined together, provide advanced features for repository management:
- Enforce commit policies and run tasks with Git server hooks.
- Define which file types to treat as binary, and set the languages to use for
syntax highlighting with the
.gitattributes
file. - To keep a Git repository as a subdirectory in another repository, use Git submodules with GitLab CI.
- When working with extremely large repositories, you can use a partial clone of a repository instead of a complete clone.
- GitLab APIs for
.gitignore
files, commits, tags, and repositories.
Git Large File Storage (LFS)
Many Git projects must manage large binary assets, such as videos and images. Implementing Git Large File Storage can help manage these assets while keeping your repository small:
- User documentation for Git LFS at GitLab
- Administrator documentation for Git LFS at GitLab
- Blog post: Getting Started with Git LFS
- Migrate an existing Git repository with Git LFS
- Remove objects from Git LFS
- Blog post: Towards a production-quality open source Git LFS server
Related topics
- Official Git documentation, including Git on the Server - GitLab
- Git troubleshooting techniques
- Git commands collected by the GitLab support team
- Blog post: Git Tips & Tricks
- Blog post: Eight Tips to help you work better with Git