Commit c2e66c1c authored by Marcia Ramos's avatar Marcia Ramos

Merge branch 'docs-code-block-style-6' into 'master'

Fix whitespace in topic, university, workflow docs

See merge request gitlab-org/gitlab-ce!30603
parents ebfa2b49 298252bb
...@@ -54,6 +54,7 @@ project. ...@@ -54,6 +54,7 @@ project.
--- ---
## Git Setup ## Git Setup
Workshop Time! Workshop Time!
--- ---
...@@ -229,8 +230,6 @@ git push origin squash_some_bugs ...@@ -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) - 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) - 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 ...@@ -266,20 +265,22 @@ git push origin squash_some_bugs
### Example 1/2 ### Example 1/2
git checkout -b conflicts_branch ```sh
git checkout -b conflicts_branch
# vi conflicts.rb # vi conflicts.rb
# Add 'Line4' and 'Line5' # Add 'Line4' and 'Line5'
git commit -am "add line4 and line5" git commit -am "add line4 and line5"
git push origin conflicts_branch git push origin conflicts_branch
git checkout master git checkout master
# vi conflicts.rb # vi conflicts.rb
# Add 'Line6' and 'Line7' # Add 'Line6' and 'Line7'
git commit -am "add line6 and line7" git commit -am "add line6 and line7"
git push origin master git push origin master
```
--- ---
...@@ -287,20 +288,22 @@ git push origin squash_some_bugs ...@@ -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. Create a merge request on the GitLab web UI. You'll see a conflict warning.
git checkout conflicts_branch ```sh
git fetch git checkout conflicts_branch
git rebase master git fetch
git rebase master
# Fix conflicts by editing the files. # Fix conflicts by editing the files.
git add conflicts.rb git add conflicts.rb
# No need to commit this file # No need to commit this file
git rebase --continue git rebase --continue
# Remember that we have rewritten our commit history so we # Remember that we have rewritten our commit history so we
# need to force push so that our remote branch is restructured # need to force push so that our remote branch is restructured
git push origin conflicts_branch -f 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. ...@@ -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: 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: 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: To remove a file from disk and repo use 'git rm' and to rm a dir use the '-r' flag:
git rm '*.txt' ```sh
git rm -r <dirname> 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`: 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 ...@@ -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: 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: Add files and change message with:
git commit --amend -m "New Message" ```sh
git commit --amend -m "New Message"
```
Undo last and remove changes Undo last and remove changes
git reset --hard HEAD^ ```sh
git reset --hard HEAD^
```
Same as last one but for two commits back: Same as last one but for two commits back:
git reset --hard HEAD^^ ```sh
git reset --hard HEAD^^
```
Don't reset after pushing Don't reset after pushing
...@@ -373,35 +392,38 @@ Don't reset after pushing ...@@ -373,35 +392,38 @@ Don't reset after pushing
1. Pull for updates 1. Pull for updates
1. Push changes 1. Push changes
---- ---
# Change file edit_this_file.rb ```sh
git status # Change file edit_this_file.rb
git commit -am "kjkfjkg" git status
git log git commit -am "kjkfjkg"
git commit --amend -m "New comment added" git log
git log git commit --amend -m "New comment added"
git reset --soft HEAD^ git log
git log git reset --soft HEAD^
git pull origin master git log
git push origin master 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 Reset removes the commit while revert removes the changes but leaves the commit
Revert is safer considering we can revert a revert Revert is safer considering we can revert a revert
# Changed file ```sh
git commit -am "bug introduced" # Changed file
git revert HEAD git commit -am "bug introduced"
# New commit created reverting changes git revert HEAD
# Now we want to re apply the reverted commit # New commit created reverting changes
git log # take hash from the revert commit # Now we want to re apply the reverted commit
git revert <rev commit hash> git log # take hash from the revert commit
# reverted commit is back (new commit created again) 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 ...@@ -415,11 +437,11 @@ Revert is safer considering we can revert a revert
### Version Control ### Version Control
- Local VCS was used with a filesystem or a simple db. - Local VCS was used with a filesystem or a simple db.
- Centralized VCS such as Subversion includes collaboration but - Centralized VCS such as Subversion includes collaboration but
still is prone to data loss as the main server is the single point of still is prone to data loss as the main server is the single point of
failure. failure.
- Distributed VCS enables the team to have a complete copy of the project - 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 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 server failing the project can be recovered by any of the latest copies
from the team from the team
...@@ -30,7 +30,7 @@ comments: false ...@@ -30,7 +30,7 @@ comments: false
git reset --hard HEAD^^ git reset --hard HEAD^^
``` ```
** Don't reset after pushing ** **Don't reset after pushing**
## Reset Workflow ## Reset Workflow
......
...@@ -46,7 +46,6 @@ need to do (we assume you have [git-annex enabled](../git_annex.md#using-gitlab- ...@@ -46,7 +46,6 @@ need to do (we assume you have [git-annex enabled](../git_annex.md#using-gitlab-
repository and that you have made backups in case something goes wrong). repository and that you have made backups in case something goes wrong).
Fire up a terminal, navigate to your Git repository and: Fire up a terminal, navigate to your Git repository and:
1. Disable `git-annex`: 1. Disable `git-annex`:
```bash ```bash
...@@ -216,16 +215,16 @@ branches created by Git Annex: `git-annex`, and all under `synced/`. ...@@ -216,16 +215,16 @@ branches created by Git Annex: `git-annex`, and all under `synced/`.
![repository branches](images/git-annex-branches.png) ![repository branches](images/git-annex-branches.png)
You can also do this on the commandline with: You can also do this on the command line with:
```bash ```bash
git branch -d synced/master git branch -d synced/master
git branch -d synced/git-annex git branch -d synced/git-annex
git push origin :synced/master git push origin :synced/master
git push origin :synced/git-annex git push origin :synced/git-annex
git push origin :git-annex git push origin :git-annex
git remote prune origin git remote prune origin
``` ```
If there are still some Annex objects inside your repository (`.git/annex/`) If there are still some Annex objects inside your repository (`.git/annex/`)
or references inside `.git/config`, run `annex uninit` again: or references inside `.git/config`, run `annex uninit` again:
......
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