Commit 298252bb authored by Marcel Amirault's avatar Marcel Amirault Committed by Marcia Ramos

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.
parent ebfa2b49
......@@ -54,6 +54,7 @@ project.
---
## Git Setup
Workshop Time!
---
......@@ -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
- 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
- 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
......@@ -30,7 +30,7 @@ comments: false
git reset --hard HEAD^^
```
** Don't reset after pushing **
**Don't reset after pushing**
## Reset Workflow
......
......@@ -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).
Fire up a terminal, navigate to your Git repository and:
1. Disable `git-annex`:
```bash
......@@ -216,16 +215,16 @@ branches created by Git Annex: `git-annex`, and all under `synced/`.
![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
git branch -d synced/master
git branch -d synced/git-annex
git push origin :synced/master
git push origin :synced/git-annex
git push origin :git-annex
git remote prune origin
```
```bash
git branch -d synced/master
git branch -d synced/git-annex
git push origin :synced/master
git push origin :synced/git-annex
git push origin :git-annex
git remote prune origin
```
If there are still some Annex objects inside your repository (`.git/annex/`)
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