summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAchilleas Pipinellis <axil@gitlab.com>2019-05-19 20:47:33 +0000
committerAchilleas Pipinellis <axil@gitlab.com>2019-05-19 20:47:33 +0000
commita4777d6ea91433a134358de8ca446d96a2e5fd6f (patch)
tree9218d11c1591775a61bb7af08729925fbffcd1f3
parent0ed434f950089c7b35992348ec62ca7e1e4fbb7b (diff)
parentbd9be8fda4f4c00a8f985c2ff587d1329df4ae17 (diff)
downloadgitlab-ce-a4777d6ea91433a134358de8ca446d96a2e5fd6f.tar.gz
Merge branch '58284-git-basics-docs' into 'master'
Resolve "Docs: document `git init`" Closes #58284 See merge request gitlab-org/gitlab-ce!28450
-rw-r--r--doc/gitlab-basics/start-using-git.md24
1 files changed, 23 insertions, 1 deletions
diff --git a/doc/gitlab-basics/start-using-git.md b/doc/gitlab-basics/start-using-git.md
index e30afdf8a40..b3c5d32f2f5 100644
--- a/doc/gitlab-basics/start-using-git.md
+++ b/doc/gitlab-basics/start-using-git.md
@@ -71,6 +71,18 @@ git config --global --list
Start using Git via the command line with the most basic
commands as described below.
+## Initialize a local directory for Git version control
+
+If you have an existing local directory that you want to *initialize* for version control, use the `init` command to instruct Git to begin tracking the directory:
+
+```bash
+git init
+```
+
+This creates a `.git` directory that contains the Git configuration files.
+
+Once the directory has been initialized, you can [add a remote repository](#add-a-remote-repository) and [send changes to GitLab.com](#send-changes-to-gitlabcom). View the instructions on [Create a project](../gitlab-basics/create-project.html#push-to-create-a-new-project) to create a new project on GitLab with your changes.
+
### Clone a repository
To start working locally on an existing remote repository,
@@ -140,6 +152,16 @@ To view your remote repositories, type:
git remote -v
```
+### Add a remote repository
+
+To add a link to a remote repository:
+
+```bash
+git remote add SOURCE-NAME REPOSITORY-PATH
+```
+
+You'll use this source name every time you [push changes to GitLab.com](#send-changes-to-gitlabcom), so use something easy to remember and type.
+
### Create a branch
To create a branch, type the following (spaces won't be recognized in the branch name, so you will need to use a hyphen or underscore):
@@ -193,7 +215,7 @@ git commit -m "COMMENT TO DESCRIBE THE INTENTION OF THE COMMIT"
NOTE: **Note:**
The `.` character typically means _all_ in Git.
-### Send changes to gitlab.com
+### Send changes to GitLab.com
To push all local commits to the remote repository: