info:To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
# Make your first Git commit
This tutorial is going to teach you a little bit about how Git works, and walk
you through the steps of creating your own project and editing a file.
When you're done, you'll have a project where you can practice using Git.
## What you need
Before you begin:
-[Install Git on your local machine](../topics/git/how_to_install_git/index.md).
- Ensure you can sign in to an instance of GitLab. If your organization doesn't
have GitLab, create an account on GitLab.com.
-[Create SSH keys and add them to GitLab](../ssh/index.md). SSH keys are how you
securely communicate between your computer and GitLab.
## What is Git?
Before we jump into steps, let's go over some basic Git concepts.
Git is a version control system. It's used to track changes to files.
You store files, like code or documents, in a Git *repository*. When you want to edit the files, you
*clone* the repository to your computer, make the changes, and *push* your changes
back to the repository. In GitLab, a Git repository is located in
a *project*.
Each time you push a change, Git records it as a unique *commit*. These commits make up
the history of when and how a file changed, and who changed it.
```mermaid
graph LR
subgraph Repository commit history
A(Author: Alex<br>Date: 3 Jan at 1PM<br>Commit message: Added sales figures for January<br> Commit ID: 123abc12) ---> B
B(Author: Sam<br>Date: 4 Jan at 10AM<br>Commit message: Removed outdated marketing information<br> Commit ID: aabb1122) ---> C
C(Author: Zhang<br>Date: 5 Jan at 3PM<br>Commit message: Added a new 'Invoices' file<br> Commit ID: ddee4455)
end
```
When you work in a Git repository, you work in *branches*. By default, the contents
of a repository are in a default branch. To make changes, you:
1. Create your own branch, which is a snapshot of the default branch at the time
you create it.
1. Make changes and push them to your branch. Each push creates a commit.
1. When you're ready, *merge* your branch into the default branch.
Now you're ready to merge the changes from your `example-tutorial-branch` branch
to the default branch (`main`).
1. Check out the default branch for your repository.
```shell
git checkout main
```
1. Merge your branch into the default branch.
```shell
git merge example-tutorial-branch
```
1. Push the changes.
```shell
git push
```
NOTE:
For this tutorial, you merge your branch directly to the default branch for your
repository. In GitLab, you typically use a [merge request](../user/project/merge_requests/)
to merge your branch.
### View your changes in GitLab
You did it! You updated the `README.md` file in your branch, and you merged those changes
into the `main` branch.
Let's look in the UI and confirm it.
1. In your project, scroll down and view the `README.md` file.
Your changes should be visible.
1. Above the list of files, select **History**.
Your commit and commit message should display.
Now you can change back to your personal branch (`git checkout example-tutorial-branch`)
and continue updating or even creating files. Type `git status` to view the status
of your changes and commit with abandon.
Don't worry if you mess things up. Everything in Git can be reverted, and if you
find you can't recover, you can always create a new branch and start again.
Nice work.
## Find more Git learning resources
- Get a complete introduction to Git in the <iclass="fa fa-youtube-play youtube"aria-hidden="true"></i>[Git for GitLab](https://www.youtube.com/watch?v=4lxvVj7wlZw) beginner's course (1h 33m).
- Find other tutorials about Git and GitLab on the [tutorials page](index.md).