Commit ccf28723 authored by Kati Paizee's avatar Kati Paizee

Merge branch 'selhorn-git-reorg' into 'master'

Reorganized Git content

See merge request gitlab-org/gitlab!83699
parents cd711f52 06c17619
---
stage: Create
group: Source Code
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"
type: howto
redirect_to: '../tutorials/make_your_first_git_commit.md'
remove_date: '2022-06-26'
---
# How to create a branch **(FREE)**
This document was moved to [another location](../tutorials/make_your_first_git_commit.md).
A branch is an independent line of development in a [project](../user/project/index.md).
When you create a branch (in your [terminal](start-using-git.md#create-a-branch) or with
[the web interface](../user/project/repository/web_editor.md#create-a-new-branch)),
you are creating a snapshot of a certain branch, usually the main branch,
at its current state. From there, you can start to make your own changes without
affecting the main codebase. The history of your changes is tracked in your branch.
When your changes are ready, you then merge them into the rest of the codebase with a
[merge request](../user/project/merge_requests/creating_merge_requests.md).
<!-- This redirect file can be deleted after <YYYY-MM-DD>. -->
<!-- Redirects that point to other docs in the same project expire in three months. -->
<!-- Redirects that point to docs in a different project or site (for example, link is not relative and starts with `https:`) expire in one year. -->
<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/redirects.html -->
\ No newline at end of file
......@@ -6,7 +6,7 @@ type: howto, tutorial
description: "Introduction to using Git through the command line."
---
# Start using Git on the command line **(FREE)**
# Git on the command line **(FREE)**
[Git](https://git-scm.com/) is an open-source distributed version control system. GitLab is built
on top of Git.
......@@ -14,6 +14,9 @@ on top of Git.
You can do many Git operations directly in GitLab. However, the command line is required for advanced tasks,
like fixing complex merge conflicts or rolling back commits.
If you're new to Git and want to learn by working in your own project,
[learn how to make your first commit](../tutorials/make_your_first_git_commit.md).
For a quick reference of Git commands, download a [Git Cheat Sheet](https://about.gitlab.com/images/press/git-cheat-sheet.pdf).
For more information about the advantages of working with Git and GitLab:
......@@ -24,75 +27,7 @@ For more information about the advantages of working with Git and GitLab:
To help you visualize what you're doing locally, you can install a
[Git GUI app](https://git-scm.com/download/gui/).
## Git terminology
If you're familiar with Git terminology, you might want to skip this section and
go directly to [prerequisites](#prerequisites).
### Repository
In GitLab, files are stored in a **repository**. A repository is similar to how you
store files in a folder or directory on your computer.
- A **remote repository** refers to the files in GitLab.
- A **local copy** refers to the files on your computer.
<!-- vale gitlab.Spelling = NO -->
<!-- vale gitlab.SubstitutionWarning = NO -->
Often, the word "repository" is shortened to "repo".
<!-- vale gitlab.Spelling = YES -->
<!-- vale gitlab.SubstitutionWarning = YES -->
In GitLab, a repository is contained in a **project**.
### Fork
When you want to contribute to someone else's repository, you make a copy of it.
This copy is called a [**fork**](../user/project/repository/forking_workflow.md#creating-a-fork).
The process is called "creating a fork."
When you fork a repo, you create a copy of the project in your own
[namespace](../user/group/#namespaces). You then have write permissions to modify the project files
and settings.
For example, you can fork this project, <https://gitlab.com/gitlab-tests/sample-project/>, into your namespace.
You now have your own copy of the repository. You can view the namespace in the URL, for example
`https://gitlab.com/your-namespace/sample-project/`.
Then you can clone the repository to your local machine, work on the files, and submit changes back to the
original repository.
### Difference between download and clone
To create a copy of a remote repository's files on your computer, you can either
**download** or **clone** the repository. If you download it, you cannot sync the repository with the
remote repository on GitLab.
[Cloning](#clone-a-repository) a repository is the same as downloading, except it preserves the Git connection
with the remote repository. You can then modify the files locally and
upload the changes to the remote repository on GitLab.
### Pull and push
After you save a local copy of a repository and modify the files on your computer, you can upload the
changes to GitLab. This is referred to as **pushing** to the remote, because you use the command
[`git push`](#send-changes-to-gitlabcom).
When the remote repository changes, your local copy is behind. You can update your local copy with the new
changes in the remote repository.
This is referred to as **pulling** from the remote, because you use the command
[`git pull`](#download-the-latest-changes-in-the-project).
## Prerequisites
To start using GitLab with Git, complete the following tasks:
- Create and sign in to a GitLab account.
- [Open a terminal](#open-a-terminal).
- [Install Git](#install-git) on your computer.
- [Configure Git](#configure-git).
- [Choose a repository](#choose-a-repository).
### Open a terminal
## Choose a terminal
To execute Git commands on your computer, you must open a terminal (also known as command
prompt, command shell, and command line). Here are some options:
......@@ -107,9 +42,9 @@ prompt, command shell, and command line). Here are some options:
- For Linux users:
- Built-in [Linux Terminal](https://ubuntu.com/tutorials/command-line-for-beginners#3-opening-a-terminal).
### Install Git
## Confirm Git is installed
Determine if Git is already installed on your computer by opening a terminal
You can determine if Git is already installed on your computer by opening a terminal
and running this command:
```shell
......@@ -123,9 +58,8 @@ git version X.Y.Z
```
If your computer doesn't recognize `git` as a command, you must [install Git](../topics/git/how_to_install_git/index.md).
After you install Git, run `git --version` to confirm that it installed correctly.
### Configure Git
## Configure Git
To start using Git from your computer, you must enter your credentials
to identify yourself as the author of your work. The username and email address
......@@ -156,7 +90,7 @@ should match the ones you use in GitLab.
You can read more on how Git manages configurations in the
[Git configuration documentation](https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration).
### Choose a repository
## Choose a repository
Before you begin, choose the repository you want to work in. You can use any project you have permission to
access on GitLab.com or any other GitLab instance.
......
......@@ -26,10 +26,11 @@ The following resources can help you get started with Git:
- [Git-ing started with Git](https://www.youtube.com/watch?v=Ce5nz5n41z4),
a video introduction to Git.
- [Make your first Git commit](../../tutorials/make_your_first_git_commit.md)
- [Git Basics](https://git-scm.com/book/en/v2/Getting-Started-Git-Basics)
- [Git on the Server - GitLab](https://git-scm.com/book/en/v2/Git-on-the-Server-GitLab)
- [How to install Git](how_to_install_git/index.md)
- [Git terminology](../../gitlab-basics/start-using-git.md#git-terminology)
- [Git terminology](terminology.md)
- [Start using Git on the command line](../../gitlab-basics/start-using-git.md)
- [Edit files through the command line](../../gitlab-basics/command-line-commands.md)
- [GitLab Git Cheat Sheet (download)](https://about.gitlab.com/images/press/git-cheat-sheet.pdf)
......
---
stage: Create
group: Source Code
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
---
# Git terminology
The following are commonly-used Git terms.
## Repository
In GitLab, files are stored in a **repository**. A repository is similar to how you
store files in a folder or directory on your computer.
- A **remote repository** refers to the files in GitLab.
- A **local copy** refers to the files on your computer.
<!-- vale gitlab.Spelling = NO -->
<!-- vale gitlab.SubstitutionWarning = NO -->
Often, the word "repository" is shortened to "repo".
<!-- vale gitlab.Spelling = YES -->
<!-- vale gitlab.SubstitutionWarning = YES -->
In GitLab, a repository is contained in a **project**.
## Fork
When you want to contribute to someone else's repository, you make a copy of it.
This copy is called a [**fork**](../../user/project/repository/forking_workflow.md#creating-a-fork).
The process is called "creating a fork."
When you fork a repo, you create a copy of the project in your own
[namespace](../../user/group/#namespaces). You then have write permissions to modify the project files
and settings.
For example, you can fork this project, <https://gitlab.com/gitlab-tests/sample-project/>, into your namespace.
You now have your own copy of the repository. You can view the namespace in the URL, for example
`https://gitlab.com/your-namespace/sample-project/`.
Then you can clone the repository to your local machine, work on the files, and submit changes back to the
original repository.
## Difference between download and clone
To create a copy of a remote repository's files on your computer, you can either
**download** or **clone** the repository. If you download it, you cannot sync the repository with the
remote repository on GitLab.
[Cloning](../../gitlab-basics/start-using-git.md#clone-a-repository) a repository is the same as downloading, except it preserves the Git connection
with the remote repository. You can then modify the files locally and
upload the changes to the remote repository on GitLab.
## Pull and push
After you save a local copy of a repository and modify the files on your computer, you can upload the
changes to GitLab. This is referred to as **pushing** to the remote, because you use the command
[`git push`](../../gitlab-basics/start-using-git.md#send-changes-to-gitlabcom).
When the remote repository changes, your local copy is behind. You can update your local copy with the new
changes in the remote repository.
This is referred to as **pulling** from the remote, because you use the command
[`git pull`](../../gitlab-basics/start-using-git.md#download-the-latest-changes-in-the-project).
......@@ -250,7 +250,7 @@ Let's look in the UI and confirm your changes. Go to your project.
- Scroll down and view the contents of the `README.md` file.
Your changes should be visible.
- Above the `README.md` file, view the text in the `Last commit` column.
- Above the `README.md` file, view the text in the **Last commit** column.
Your commit message is displayed in this column:
![Commit message](img/commit_message_v14_10.png)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment