summaryrefslogtreecommitdiff
path: root/doc/university
diff options
context:
space:
mode:
Diffstat (limited to 'doc/university')
-rw-r--r--doc/university/training/end-user/README.md30
-rw-r--r--doc/university/training/topics/bisect.md6
-rw-r--r--doc/university/training/topics/cherry_picking.md2
-rw-r--r--doc/university/training/topics/env_setup.md14
-rw-r--r--doc/university/training/topics/feature_branching.md2
-rw-r--r--doc/university/training/topics/getting_started.md10
-rw-r--r--doc/university/training/topics/git_add.md10
-rw-r--r--doc/university/training/topics/git_log.md12
-rw-r--r--doc/university/training/topics/merge_conflicts.md4
-rw-r--r--doc/university/training/topics/rollback_commits.md12
-rw-r--r--doc/university/training/topics/stash.md12
-rw-r--r--doc/university/training/topics/subtree.md4
-rw-r--r--doc/university/training/topics/tags.md2
-rw-r--r--doc/university/training/topics/unstage.md8
-rw-r--r--doc/university/training/user_training.md22
15 files changed, 75 insertions, 75 deletions
diff --git a/doc/university/training/end-user/README.md b/doc/university/training/end-user/README.md
index be9db9229cd..7832d89aaf5 100644
--- a/doc/university/training/end-user/README.md
+++ b/doc/university/training/end-user/README.md
@@ -59,7 +59,7 @@ Workshop Time!
- One-time configuration of the Git client:
-```bash
+```shell
git config --global user.name "Your Name"
git config --global user.email you@example.com
```
@@ -68,7 +68,7 @@ git config --global user.email you@example.com
each project
- Check settings with:
-```bash
+```shell
git config --global --list
```
@@ -81,7 +81,7 @@ git config --global --list
- Create a workspace or development directory
- This is where we'll be working and adding content
-```bash
+```shell
mkdir ~/development
cd ~/development
@@ -210,7 +210,7 @@ git push origin squash_some_bugs
### Example 1/2
-```sh
+```shell
git checkout -b conflicts_branch
# vi conflicts.rb
@@ -231,7 +231,7 @@ git push origin master
Create a merge request on the GitLab web UI. You'll see a conflict warning.
-```sh
+```shell
git checkout conflicts_branch
git fetch
git rebase master
@@ -261,26 +261,26 @@ git push origin conflicts_branch -f
To remove files from stage use reset HEAD. Where HEAD is the last commit of the current branch:
-```sh
+```shell
git reset HEAD <file>
```
This will unstage the file but maintain the modifications. To revert the file back to the state it was in before the changes we can use:
-```sh
+```shell
git checkout -- <file>
```
To remove a file from disk and repo use `git rm` and to remove a directory use the `-r` flag:
-```sh
+```shell
git rm '*.txt'
git rm -r <dirname>
```
If we want to remove a file from the repository but keep it on disk, say we forgot to add it to our .gitignore file then use `--cache`:
-```sh
+```shell
git rm <filename> --cache
```
@@ -288,25 +288,25 @@ git rm <filename> --cache
Undo last commit putting everything back into the staging area:
-```sh
+```shell
git reset --soft HEAD^
```
Add files and change message with:
-```sh
+```shell
git commit --amend -m "New Message"
```
Undo last and remove changes
-```sh
+```shell
git reset --hard HEAD^
```
Same as last one but for two commits back:
-```sh
+```shell
git reset --hard HEAD^^
```
@@ -325,7 +325,7 @@ Don't reset after pushing
1. Pull for updates
1. Push changes
-```sh
+```shell
# Change file edit_this_file.rb
git status
git commit -am "kjkfjkg"
@@ -343,7 +343,7 @@ git push origin master
Reset removes the commit while revert removes the changes but leaves the commit
Revert is safer considering we can revert a revert
-```sh
+```shell
# Changed file
git commit -am "bug introduced"
git revert HEAD
diff --git a/doc/university/training/topics/bisect.md b/doc/university/training/topics/bisect.md
index 24dc670d9d5..cb6d6e683a8 100644
--- a/doc/university/training/topics/bisect.md
+++ b/doc/university/training/topics/bisect.md
@@ -19,7 +19,7 @@ comments: false
## Setup
-```sh
+```shell
mkdir bisect-ex
cd bisect-ex
touch index.html
@@ -36,7 +36,7 @@ comments: false
vi index.html
```
-```sh
+```shell
# Add all good 3
git add -A
git commit -m "fourth commit"
@@ -56,7 +56,7 @@ comments: false
## Commands
-```sh
+```shell
git bisect start
# Test your code
git bisect bad
diff --git a/doc/university/training/topics/cherry_picking.md b/doc/university/training/topics/cherry_picking.md
index f5bcdfcbf12..47734834801 100644
--- a/doc/university/training/topics/cherry_picking.md
+++ b/doc/university/training/topics/cherry_picking.md
@@ -17,7 +17,7 @@ comments: false
1. Check out the 'stable' branch
1. Cherry pick the commit using the SHA obtained earlier
-```bash
+```shell
git checkout master
git checkout -b stable
git checkout master
diff --git a/doc/university/training/topics/env_setup.md b/doc/university/training/topics/env_setup.md
index f65b4f68868..be517032a1b 100644
--- a/doc/university/training/topics/env_setup.md
+++ b/doc/university/training/topics/env_setup.md
@@ -15,11 +15,11 @@ comments: false
- **Linux**
- ```bash
+ ```shell
sudo yum install git-all
```
- ```bash
+ ```shell
sudo apt-get install git-all
```
@@ -27,18 +27,18 @@ comments: false
One-time configuration of the Git client
-```bash
+```shell
git config --global user.name "Your Name"
git config --global user.email you@example.com
```
## Configure SSH Key
-```bash
+```shell
ssh-keygen -t rsa -b 4096 -C "you@computer-name"
```
-```bash
+```shell
# You will be prompted for the following information. Press enter to accept the defaults. Defaults appear in parentheses.
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/you/.ssh/id_rsa):
@@ -52,10 +52,10 @@ The key fingerprint is:
Copy your public key and add it to your GitLab profile
-```bash
+```shell
cat ~/.ssh/id_rsa.pub
```
-```bash
+```shell
ssh-rsa AAAAB3NzaC1yc2EAAAADAQEL17Ufacg8cDhlQMS5NhV8z3GHZdhCrZbl4gz you@example.com
```
diff --git a/doc/university/training/topics/feature_branching.md b/doc/university/training/topics/feature_branching.md
index f530389d4da..e7454dbba75 100644
--- a/doc/university/training/topics/feature_branching.md
+++ b/doc/university/training/topics/feature_branching.md
@@ -18,7 +18,7 @@ comments: false
1. Commit
1. Push
-```sh
+```shell
git checkout -b squash_some_bugs
# Edit `bugs.rb`
git status
diff --git a/doc/university/training/topics/getting_started.md b/doc/university/training/topics/getting_started.md
index bb197f3f1ed..fd50c5492f1 100644
--- a/doc/university/training/topics/getting_started.md
+++ b/doc/university/training/topics/getting_started.md
@@ -8,13 +8,13 @@ comments: false
- Create a new repository by instantiating it through:
- ```bash
+ ```shell
git init
```
- Copy an existing project by cloning the repository through:
- ```bash
+ ```shell
git clone <url>
```
@@ -24,7 +24,7 @@ comments: false
- Bare repositories don't allow file editing or committing changes.
- Create a bare repo with:
- ```bash
+ ```shell
git init --bare project-name.git
```
@@ -35,7 +35,7 @@ comments: false
1. Create a '`Workspace`' directory in your home directory.
1. Clone the '`training-examples`' project.
-```sh
+```shell
mkdir ~/workspace
cd ~/workspace
@@ -67,7 +67,7 @@ Modified files that have been marked to go in the next commit.
1. Push the commit to the remote
1. View the Git log
-```sh
+```shell
# Edit `edit_this_file.rb`
git status
git diff
diff --git a/doc/university/training/topics/git_add.md b/doc/university/training/topics/git_add.md
index 0c9a50bb5e1..a3389af526d 100644
--- a/doc/university/training/topics/git_add.md
+++ b/doc/university/training/topics/git_add.md
@@ -8,30 +8,30 @@ Adds content to the index or staging area.
- Adds a list of file:
- ```bash
+ ```shell
git add <files>
```
- Adds all files including deleted ones:
- ```bash
+ ```shell
git add -A
```
- Add all text files in current dir:
- ```bash
+ ```shell
git add *.txt
```
- Add all text file in the project:
- ```bash
+ ```shell
git add "*.txt*"
```
- Adds all files in directory:
- ```bash
+ ```shell
git add views/layouts/
```
diff --git a/doc/university/training/topics/git_log.md b/doc/university/training/topics/git_log.md
index bae734554f5..26b389beea9 100644
--- a/doc/university/training/topics/git_log.md
+++ b/doc/university/training/topics/git_log.md
@@ -8,31 +8,31 @@ Git log lists commit history. It allows searching and filtering.
- Initiate log:
- ```sh
+ ```shell
git log
```
- Retrieve set number of records:
- ```sh
+ ```shell
git log -n 2
```
- Search commits by author. Allows user name or a regular expression.
- ```sh
+ ```shell
git log --author="user_name"
```
- Search by comment message:
- ```sh
+ ```shell
git log --grep="<pattern>"
```
- Search by date:
- ```sh
+ ```shell
git log --since=1.month.ago --until=3.weeks.ago
```
@@ -47,7 +47,7 @@ Git log lists commit history. It allows searching and filtering.
## Commands
-```sh
+```shell
cd ~/workspace
git clone git@gitlab.com:gitlab-org/gitlab-runner.git
cd gitlab-runner
diff --git a/doc/university/training/topics/merge_conflicts.md b/doc/university/training/topics/merge_conflicts.md
index a01b3dbf3e0..e59f9e2bae8 100644
--- a/doc/university/training/topics/merge_conflicts.md
+++ b/doc/university/training/topics/merge_conflicts.md
@@ -22,7 +22,7 @@ comments: false
1. Force push the changes.
1. Finally continue with the Merge Request.
-```sh
+```shell
git checkout -b conflicts_branch
# vi conflicts.rb
@@ -41,7 +41,7 @@ git push origin master
Create a merge request on the GitLab web UI. You'll see a conflict warning.
-```sh
+```shell
git checkout conflicts_branch
git fetch
git rebase master
diff --git a/doc/university/training/topics/rollback_commits.md b/doc/university/training/topics/rollback_commits.md
index 333b2f23a1b..616ed972ab0 100644
--- a/doc/university/training/topics/rollback_commits.md
+++ b/doc/university/training/topics/rollback_commits.md
@@ -8,25 +8,25 @@ comments: false
- Undo last commit putting everything back into the staging area:
- ```sh
+ ```shell
git reset --soft HEAD^
```
- Add files and change message with:
- ```sh
+ ```shell
git commit --amend -m "New Message"
```
- Undo last and remove changes:
- ```sh
+ ```shell
git reset --hard HEAD^
```
- Same as last one but for two commits back:
- ```sh
+ ```shell
git reset --hard HEAD^^
```
@@ -47,7 +47,7 @@ comments: false
## Commands
-```sh
+```shell
# Change file edit_this_file.rb
git status
git commit -am "kjkfjkg"
@@ -66,7 +66,7 @@ git push origin master
- Reset removes the commit while revert removes the changes but leaves the commit
- Revert is safer considering we can revert a revert
-```sh
+```shell
# Changed file
git commit -am "bug introduced"
git revert HEAD
diff --git a/doc/university/training/topics/stash.md b/doc/university/training/topics/stash.md
index c582240d0f7..28d28382d62 100644
--- a/doc/university/training/topics/stash.md
+++ b/doc/university/training/topics/stash.md
@@ -9,7 +9,7 @@ and we need to change to a different branch.
- Stash:
- ```sh
+ ```shell
git stash save
# or
git stash
@@ -19,7 +19,7 @@ and we need to change to a different branch.
- Apply stash to keep working on it:
- ```sh
+ ```shell
git stash apply
# or apply a specific one from out stack
git stash apply stash@{3}
@@ -28,7 +28,7 @@ and we need to change to a different branch.
- Every time we save a stash it gets stacked so by using `list` we can see all our
stashes.
- ```sh
+ ```shell
git stash list
# or for more information (log methods)
git stash list --stat
@@ -36,7 +36,7 @@ and we need to change to a different branch.
- To clean our stack we need to manually remove them:
- ```sh
+ ```shell
# drop top stash
git stash drop
# or
@@ -47,7 +47,7 @@ and we need to change to a different branch.
- Apply and drop on one command:
- ```sh
+ ```shell
git stash pop
```
@@ -64,7 +64,7 @@ and we need to change to a different branch.
1. Apply with pop
1. View list to confirm changes
-```sh
+```shell
# Modify edit_this_file.rb file
git add .
diff --git a/doc/university/training/topics/subtree.md b/doc/university/training/topics/subtree.md
index 981918d4758..e1ee7b6a836 100644
--- a/doc/university/training/topics/subtree.md
+++ b/doc/university/training/topics/subtree.md
@@ -17,7 +17,7 @@ comments: false
- Ex: `git config alias.sbp 'subtree pull --prefix st /
git@gitlab.com:balameb/subtree-nested-example.git master --squash'`.
-```sh
+```shell
# Add an alias
# Add
git config alias.sba 'subtree add --prefix st /
@@ -37,7 +37,7 @@ comments: false
```
-```sh
+```shell
# Adding, or committing won't change the sub repo at remote
# even if we push
git add -A
diff --git a/doc/university/training/topics/tags.md b/doc/university/training/topics/tags.md
index 631b93cc384..01eb1dd9b4c 100644
--- a/doc/university/training/topics/tags.md
+++ b/doc/university/training/topics/tags.md
@@ -17,7 +17,7 @@ type: reference
- Create an annotated tag
- Push the tags to the remote repository
-```sh
+```shell
git checkout master
# Lightweight tag
diff --git a/doc/university/training/topics/unstage.md b/doc/university/training/topics/unstage.md
index 9a9d42221a4..b74cc9b2f0a 100644
--- a/doc/university/training/topics/unstage.md
+++ b/doc/university/training/topics/unstage.md
@@ -6,25 +6,25 @@ comments: false
- To remove files from stage use reset HEAD where HEAD is the last commit of the current branch. This will unstage the file but maintain the modifications.
- ```bash
+ ```shell
git reset HEAD <file>
```
- To revert the file back to the state it was in before the changes we can use:
- ```bash
+ ```shell
git checkout -- <file>
```
- To remove a file from disk and repo use `git rm` and to remove a directory use the `-r` flag:
- ```sh
+ ```shell
git rm '*.txt'
git rm -r <dirname>
```
- If we want to remove a file from the repository but keep it on disk, say we forgot to add it to our `.gitignore` file then use `--cache`:
- ```sh
+ ```shell
git rm <filename> --cache
```
diff --git a/doc/university/training/user_training.md b/doc/university/training/user_training.md
index 08b7635f9ce..267a8e8913b 100644
--- a/doc/university/training/user_training.md
+++ b/doc/university/training/user_training.md
@@ -63,18 +63,18 @@ Use the tools at your disposal when you get stuck.
One-time configuration of the Git client:
-```sh
+```shell
git config --global user.name "Your Name"
git config --global user.email you@example.com
```
## Configure SSH Key
-```sh
+```shell
ssh-keygen -t rsa -b 4096 -C "you@computer-name"
```
-```sh
+```shell
# You will be prompted for the following information. Press enter to accept the defaults. Defaults appear in parentheses.
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/you/.ssh/id_rsa):
@@ -88,11 +88,11 @@ The key fingerprint is:
Copy your public key and add it to your GitLab profile:
-```sh
+```shell
cat ~/.ssh/id_rsa.pub
```
-```sh
+```shell
ssh-rsa AAAAB3NzaC1yc2EAAAADAQEL17Ufacg8cDhlQMS5NhV8z3GHZdhCrZbl4gz you@example.com
```
@@ -105,7 +105,7 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQEL17Ufacg8cDhlQMS5NhV8z3GHZdhCrZbl4gz you@example.
## Commands (project)
-```sh
+```shell
mkdir ~/development
cd ~/development
@@ -144,7 +144,7 @@ Modified files that have been marked to go in the next commit.
## Commands (committing)
-```sh
+```shell
# Edit `edit_this_file.rb`
git status
git diff
@@ -172,7 +172,7 @@ git log
## Commands (feature branching)
-```sh
+```shell
git checkout -b squash_some_bugs
# Edit `bugs.rb`
git status
@@ -246,7 +246,7 @@ Additional resources: <https://git-scm.com/book/en/v2/Git-Basics-Tagging>.
## Commands (tags)
-```sh
+```shell
git checkout master
# Lightweight tag
@@ -279,7 +279,7 @@ git push origin --tags
After creating a merge request you should notice that conflicts exist. Resolve
the conflicts locally by rebasing.
-```sh
+```shell
git rebase master
# Fix conflicts by editing the files.
@@ -310,7 +310,7 @@ Squash these in to meaningful commits using an interactive rebase.
Squash the commits on the same branch we used for the merge conflicts step.
-```sh
+```shell
git rebase -i master
```