diff options
author | Marcel Amirault <mamirault@gitlab.com> | 2019-07-31 13:29:10 +0300 |
---|---|---|
committer | Marcia Ramos <marcia@gitlab.com> | 2019-07-31 13:29:10 +0300 |
commit | 298252bb6be9cf9fe725701fe172fee774d7b33a (patch) | |
tree | 8eb1d2b9dd03d2e52df7462a1fa95717abb40305 /doc/university | |
parent | ebfa2b49ac0f5857f7b49305344dda75bbc0d3df (diff) |
Fix whitespace in topic, university, workflow docs
Many code blocks are 4spaced, and they render in GitLab
without coloring as a result, even though they are
fenced with a language label. If in a list, other items
will render as being in a code block too, even if not
meant to. This fixes all these issues, and cleans up
minor white space issues in /topic, /university, /update
and /workflow docs.
Diffstat (limited to 'doc/university')
-rw-r--r-- | doc/university/training/end-user/README.md | 152 | ||||
-rw-r--r-- | doc/university/training/topics/git_add.md | 30 | ||||
-rw-r--r-- | doc/university/training/topics/git_log.md | 30 | ||||
-rw-r--r-- | doc/university/training/topics/rollback_commits.md | 26 | ||||
-rw-r--r-- | doc/university/training/topics/stash.md | 56 | ||||
-rw-r--r-- | doc/university/training/topics/unstage.md | 28 |
6 files changed, 172 insertions, 150 deletions
diff --git a/doc/university/training/end-user/README.md b/doc/university/training/end-user/README.md index 99fb5e83387..423ba1cfbd7 100644 --- a/doc/university/training/end-user/README.md +++ b/doc/university/training/end-user/README.md @@ -54,6 +54,7 @@ project. --- ## Git Setup + Workshop Time! --- @@ -88,7 +89,7 @@ git config --global --list ``` - You might want or be required to use an SSH key. - - Instructions: [SSH](http://doc.gitlab.com/ce/ssh/README.html) + - Instructions: [SSH](http://doc.gitlab.com/ce/ssh/README.html) --- @@ -119,13 +120,13 @@ cd ~/workspace ### Git Workflow - Untracked files - - New files that Git has not been told to track previously. + - New files that Git has not been told to track previously. - Working area (Workspace) - - Files that have been modified but are not committed. + - Files that have been modified but are not committed. - Staging area (Index) - - Modified files that have been marked to go in the next commit. + - Modified files that have been marked to go in the next commit. - Upstream - - Hosted repository on a shared server + - Hosted repository on a shared server --- @@ -229,8 +230,6 @@ git push origin squash_some_bugs --- -### Feedback and Collaboration - - Review the Thoughtbot code-review guide for suggestions to follow when reviewing merge requests:[Thoughtbot](https://github.com/thoughtbot/guides/tree/master/code-review) - See GitLab merge requests for examples: [Merge Requests](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests) @@ -266,20 +265,22 @@ git push origin squash_some_bugs ### Example 1/2 - git checkout -b conflicts_branch +```sh +git checkout -b conflicts_branch - # vi conflicts.rb - # Add 'Line4' and 'Line5' +# vi conflicts.rb +# Add 'Line4' and 'Line5' - git commit -am "add line4 and line5" - git push origin conflicts_branch +git commit -am "add line4 and line5" +git push origin conflicts_branch - git checkout master +git checkout master - # vi conflicts.rb - # Add 'Line6' and 'Line7' - git commit -am "add line6 and line7" - git push origin master +# vi conflicts.rb +# Add 'Line6' and 'Line7' +git commit -am "add line6 and line7" +git push origin master +``` --- @@ -287,20 +288,22 @@ git push origin squash_some_bugs Create a merge request on the GitLab web UI. You'll see a conflict warning. - git checkout conflicts_branch - git fetch - git rebase master +```sh +git checkout conflicts_branch +git fetch +git rebase master - # Fix conflicts by editing the files. +# Fix conflicts by editing the files. - git add conflicts.rb - # No need to commit this file +git add conflicts.rb +# No need to commit this file - git rebase --continue +git rebase --continue - # Remember that we have rewritten our commit history so we - # need to force push so that our remote branch is restructured - git push origin conflicts_branch -f +# Remember that we have rewritten our commit history so we +# need to force push so that our remote branch is restructured +git push origin conflicts_branch -f +``` --- @@ -321,20 +324,28 @@ Create a merge request on the GitLab web UI. You'll see a conflict warning. To remove files from stage use reset HEAD. Where HEAD is the last commit of the current branch: - git reset HEAD <file> +```sh +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: - git checkout -- <file> +```sh +git checkout -- <file> +``` To remove a file from disk and repo use 'git rm' and to rm a dir use the '-r' flag: - git rm '*.txt' - git rm -r <dirname> +```sh +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`: - git rm <filename> --cache +```sh +git rm <filename> --cache +``` --- @@ -342,19 +353,27 @@ If we want to remove a file from the repository but keep it on disk, say we forg Undo last commit putting everything back into the staging area: - git reset --soft HEAD^ +```sh +git reset --soft HEAD^ +``` Add files and change message with: - git commit --amend -m "New Message" +```sh +git commit --amend -m "New Message" +``` Undo last and remove changes - git reset --hard HEAD^ +```sh +git reset --hard HEAD^ +``` Same as last one but for two commits back: - git reset --hard HEAD^^ +```sh +git reset --hard HEAD^^ +``` Don't reset after pushing @@ -373,35 +392,38 @@ Don't reset after pushing 1. Pull for updates 1. Push changes ----- +--- - # Change file edit_this_file.rb - git status - git commit -am "kjkfjkg" - git log - git commit --amend -m "New comment added" - git log - git reset --soft HEAD^ - git log - git pull origin master - git push origin master +```sh +# Change file edit_this_file.rb +git status +git commit -am "kjkfjkg" +git log +git commit --amend -m "New comment added" +git log +git reset --soft HEAD^ +git log +git pull origin master +git push origin master +``` --- -### Note +### git revert vs git reset -git revert vs git reset Reset removes the commit while revert removes the changes but leaves the commit Revert is safer considering we can revert a revert - # Changed file - git commit -am "bug introduced" - git revert HEAD - # New commit created reverting changes - # Now we want to re apply the reverted commit - git log # take hash from the revert commit - git revert <rev commit hash> - # reverted commit is back (new commit created again) +```sh +# Changed file +git commit -am "bug introduced" +git revert HEAD +# New commit created reverting changes +# Now we want to re apply the reverted commit +git log # take hash from the revert commit +git revert <rev commit hash> +# reverted commit is back (new commit created again) +``` --- @@ -415,11 +437,11 @@ Revert is safer considering we can revert a revert ### Version Control - - Local VCS was used with a filesystem or a simple db. - - Centralized VCS such as Subversion includes collaboration but - still is prone to data loss as the main server is the single point of - failure. - - Distributed VCS enables the team to have a complete copy of the project - and work with little dependency to the main server. In case of a main - server failing the project can be recovered by any of the latest copies - from the team +- Local VCS was used with a filesystem or a simple db. +- Centralized VCS such as Subversion includes collaboration but + still is prone to data loss as the main server is the single point of + failure. +- Distributed VCS enables the team to have a complete copy of the project + and work with little dependency to the main server. In case of a main + server failing the project can be recovered by any of the latest copies + from the team diff --git a/doc/university/training/topics/git_add.md b/doc/university/training/topics/git_add.md index 4c61d5eb175..7152fc2030b 100644 --- a/doc/university/training/topics/git_add.md +++ b/doc/university/training/topics/git_add.md @@ -10,32 +10,32 @@ Adds content to the index or staging area. - Adds a list of file: - ```bash - git add <files> - ``` + ```bash + git add <files> + ``` - Adds all files including deleted ones: - ```bash - git add -A - ``` + ```bash + git add -A + ``` ## Git add continued - Add all text files in current dir: - ```bash - git add *.txt - ``` + ```bash + git add *.txt + ``` - Add all text file in the project: - ```bash - git add "*.txt*" - ``` + ```bash + git add "*.txt*" + ``` - Adds all files in directory: - ```bash - git add views/layouts/ - ``` + ```bash + git add views/layouts/ + ``` diff --git a/doc/university/training/topics/git_log.md b/doc/university/training/topics/git_log.md index 11addcd3ee1..bae734554f5 100644 --- a/doc/university/training/topics/git_log.md +++ b/doc/university/training/topics/git_log.md @@ -8,33 +8,33 @@ Git log lists commit history. It allows searching and filtering. - Initiate log: - ```sh - git log - ``` + ```sh + git log + ``` - Retrieve set number of records: - ```sh - git log -n 2 - ``` + ```sh + git log -n 2 + ``` - Search commits by author. Allows user name or a regular expression. - ```sh - git log --author="user_name" - ``` + ```sh + git log --author="user_name" + ``` - Search by comment message: - ```sh - git log --grep="<pattern>" - ``` + ```sh + git log --grep="<pattern>" + ``` - Search by date: - ```sh - git log --since=1.month.ago --until=3.weeks.ago - ``` + ```sh + git log --since=1.month.ago --until=3.weeks.ago + ``` ## Git Log Workflow diff --git a/doc/university/training/topics/rollback_commits.md b/doc/university/training/topics/rollback_commits.md index 1e6602deef2..c17e8d59737 100644 --- a/doc/university/training/topics/rollback_commits.md +++ b/doc/university/training/topics/rollback_commits.md @@ -8,29 +8,29 @@ comments: false - Undo last commit putting everything back into the staging area: - ```sh - git reset --soft HEAD^ - ``` + ```sh + git reset --soft HEAD^ + ``` - Add files and change message with: - ```sh - git commit --amend -m "New Message" - ``` + ```sh + git commit --amend -m "New Message" + ``` - Undo last and remove changes: - ```sh - git reset --hard HEAD^ - ``` + ```sh + git reset --hard HEAD^ + ``` - Same as last one but for two commits back: - ```sh - git reset --hard HEAD^^ - ``` + ```sh + git reset --hard HEAD^^ + ``` -** Don't reset after pushing ** +**Don't reset after pushing** ## Reset Workflow diff --git a/doc/university/training/topics/stash.md b/doc/university/training/topics/stash.md index 02b2f610266..21abad88cfa 100644 --- a/doc/university/training/topics/stash.md +++ b/doc/university/training/topics/stash.md @@ -9,47 +9,47 @@ and we need to change to a different branch. - Stash: - ```sh - git stash save - # or - git stash - # or with a message - git stash save "this is a message to display on the list" - ``` + ```sh + git stash save + # or + git stash + # or with a message + git stash save "this is a message to display on the list" + ``` - Apply stash to keep working on it: - ```sh - git stash apply - # or apply a specific one from out stack - git stash apply stash@{3} - ``` + ```sh + git stash apply + # or apply a specific one from out stack + git stash apply stash@{3} + ``` - Every time we save a stash it gets stacked so by using list we can see all our stashes. - ```sh - git stash list - # or for more information (log methods) - git stash list --stat - ``` + ```sh + git stash list + # or for more information (log methods) + git stash list --stat + ``` - To clean our stack we need to manually remove them: - ```sh - # drop top stash - git stash drop - # or - git stash drop <name> - # to clear all history we can use - git stash clear - ``` + ```sh + # drop top stash + git stash drop + # or + git stash drop <name> + # to clear all history we can use + git stash clear + ``` - Apply and drop on one command: - ```sh - git stash pop - ``` + ```sh + git stash pop + ``` - If we meet conflicts we need to either reset or commit our changes. - Conflicts through `pop` will not drop a stash afterwards. diff --git a/doc/university/training/topics/unstage.md b/doc/university/training/topics/unstage.md index af16afdc5d1..fa1f63f9ec4 100644 --- a/doc/university/training/topics/unstage.md +++ b/doc/university/training/topics/unstage.md @@ -6,27 +6,27 @@ comments: false ## Unstage -- 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. +- 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 - git reset HEAD <file> - ``` + ```bash + git reset HEAD <file> + ``` - To revert the file back to the state it was in before the changes we can use: - ```bash - git checkout -- <file> - ``` + ```bash + git checkout -- <file> + ``` - To remove a file from disk and repo use 'git rm' and to rm a dir use the '-r' flag: - ```sh - git rm '*.txt' - git rm -r <dirname> - ``` + ```sh + 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 - git rm <filename> --cache - ``` + ```sh + git rm <filename> --cache + ``` |