Commit 8d496e5f authored by Craig Norris's avatar Craig Norris

Merge branch 'docs-university-deprecation-2' into 'master'

Deprecate the rest of university/

See merge request gitlab-org/gitlab!61706
parents ca3dd4eb cc016d87
......@@ -48,12 +48,27 @@ The following resources can help you get started with Git:
The following are resources on version control concepts:
- [Git concepts](../../university/training/user_training.md#git-concepts)
- [Why Git is Worth the Learning Curve](https://about.gitlab.com/blog/2017/05/17/learning-curve-is-the-biggest-challenge-developers-face-with-git/)
- [The future of SaaS hosted Git repository pricing](https://about.gitlab.com/blog/2016/05/11/git-repository-pricing/)
- [Git website on version control](https://git-scm.com/book/en/v2/Getting-Started-About-Version-Control)
- [GitLab University presentation about Version Control](https://docs.google.com/presentation/d/16sX7hUrCZyOFbpvnrAFrg6tVO5_yT98IgdAqOmXwBho/edit?usp=sharing)
### Work with Git on the command line
You can do many Git tasks from the command line:
- [Bisect](bisect.md).
- [Cherry pick](cherry_picking.md).
- [Feature branching](feature_branching.md).
- [Getting started with Git](getting_started.md).
- [Git add](git_add.md).
- [Git log](git_log.md).
- [Git stash](stash.md).
- [Merge conflicts](merge_conflicts.md).
- [Rollback commits](rollback_commits.md).
- [Subtree](subtree.md).
- [Unstage](unstage.md).
## Git tips
The following resources may help you become more efficient at using Git:
......@@ -100,5 +115,5 @@ The following relate to Git Large File Storage:
- [Migrate an existing Git repository with Git LFS](lfs/migrate_to_git_lfs.md)
- [Removing objects from LFS](lfs/index.md#removing-objects-from-lfs)
- [GitLab Git LFS user documentation](lfs/index.md)
- [GitLab Git LFS admin documentation](../../administration/lfs/index.md)
- [GitLab Git LFS administrator documentation](../../administration/lfs/index.md)
- [Towards a production quality open source Git LFS server](https://about.gitlab.com/blog/2015/08/13/towards-a-production-quality-open-source-git-lfs-server/)
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
comments: false
redirect_to: '../../user/project/merge_requests/index.md'
---
# Code review and collaboration with Merge Requests
This document was moved to [another location](../../user/project/merge_requests/index.md).
- When you want feedback create a merge request
- Target is the default branch (usually master)
- Assign or mention the person you would like to review
- Add `[Draft]` to the title if it's a work in progress
- When accepting, always delete the branch
- Anyone can comment, not just the assignee
- Push corrections to the same branch
## Merge requests
**Create your first merge request**
1. Use the blue button in the activity feed
1. View the diff (changes) and leave a comment
1. Push a new commit to the same branch
1. Review the changes again and notice the update
## Feedback and Collaboration
- Merge requests are a time for feedback and collaboration
- Giving feedback is hard
- Be as kind as possible
- Receiving feedback is hard
- Be as receptive as possible
- Feedback is about the best code, not the person. You are not your code
Review the Thoughtbot code-review guide for suggestions to follow when reviewing merge requests:
[https://github.com/thoughtbot/guides/tree/master/code-review](https://github.com/thoughtbot/guides/tree/master/code-review)
See GitLab merge requests for examples:
[https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests)
<!-- This redirect file can be deleted after <2021-08-13>. -->
<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->
---
redirect_to: 'index.md'
redirect_to: '../topics/index.md'
---
This document was moved to [another location](index.md).
This document was moved to [another location](../topics/index.md).
<!-- This redirect file can be deleted after 2021-05-11. -->
<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->
This diff is collapsed.
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
comments: false
type: index
redirect_to: '../../topics/index.md'
---
# GitLab Training Material
This document was moved to [another location](../../topics/index.md).
<!-- vale gitlab.Spelling = NO -->
All GitLab training material is stored in Markdown format. Slides are
generated using [Deckset](https://www.deckset.com/).
<!-- vale gitlab.Spelling = YES -->
All training material is open to public contribution.
This section contains the following topics:
- [Bisect](topics/bisect.md).
- [Cherry pick](topics/cherry_picking.md).
- [Code review and collaboration with Merge Requests](topics/merge_requests.md).
- [Configure your environment](topics/env_setup.md).
- [Explore GitLab](../../gitlab-basics/index.md).
- [Feature branching](topics/feature_branching.md).
- [Getting started](topics/getting_started.md).
- [GitLab flow](gitlab_flow.md).
- [GitLab Git workshop](user_training.md).
- [Git add](topics/git_add.md).
- [Git introduction](topics/git_intro.md).
- [Git log](topics/git_log.md).
- [Git stash](topics/stash.md).
- [Merge conflicts](topics/merge_conflicts.md).
- [Rollback commits](topics/rollback_commits.md).
- [Subtree](topics/subtree.md).
- [Unstage](topics/unstage.md).
## Additional Resources
1. [GitLab Documentation](https://docs.gitlab.com)
1. [GUI Clients](https://git-scm.com/downloads/guis)
1. [Pro Git book](https://git-scm.com/book/en/v2)
1. <!-- vale gitlab.Spelling = NO --> [Platzi Course](https://courses.platzi.com/courses/git-gitlab/) <!-- vale gitlab.Spelling = NO -->
1. [Code School tutorial](http://try.github.io/)
1. Contact us at `subscribers@gitlab.com`
<!-- This redirect file can be deleted after <2021-08-13>. -->
<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
comments: false
redirect_to: '../../../topics/index.md'
---
# Configure your environment
This document was removed. See our [topics](../../../topics/index.md) for similar content.
## Install
- **Windows** - Install 'Git for Windows' from [Git for Windows](https://gitforwindows.org).
- **Mac**
- Type '`git`' in the Terminal application.
- If it's not installed, it prompts you to install it.
- **GNU/Linux** - Enter `which git` in the Terminal application and press <kbd>Enter</kbd> to
determine if Git is installed on your system.
- If the output of that command gives you the path to the Git executable, similar to
`/usr/bin/git`, then Git is already installed on your system.
- If the output of the command displays "command not found" error, Git isn't installed on your system.
GitLab recommends installing Git with the default package manager of your distribution.
The following commands install Git on various GNU/Linux distributions using their
default package managers. After you run the command corresponding to your distribution
and complete the installation process, Git should be available on your system:
- **Arch Linux and its derivatives** - `sudo pacman -S git`
- **Fedora, RHEL, and CentOS** - For the `yum` package manager run `sudo yum install git-all`,
and for the `dnf` package manager run `sudo dnf install git`.
- **Debian/Ubuntu and their derivatives** - `sudo apt-get install git`
- **Gentoo** - `sudo emerge --ask --verbose dev-vcs/git`
- **openSUSE** - `sudo zypper install git`
- **FreeBSD** - `sudo pkg install git`
- **OpenBSD** - `doas pkg_add git`
## Configure Git
One-time configuration of the Git client
```shell
git config --global user.name "Your Name"
git config --global user.email you@example.com
```
## Configure SSH Key
```shell
ssh-keygen -t rsa -b 4096 -C "you@computer-name"
```
```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):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/you/.ssh/id_rsa.
Your public key has been saved in /Users/you/.ssh/id_rsa.pub.
The key fingerprint is:
39:fc:ce:94:f4:09:13:95:64:9a:65:c1:de:05:4d:01 you@computer-name
```
Copy your public key and add it to your GitLab profile
```shell
cat ~/.ssh/id_rsa.pub
```
```shell
ssh-rsa AAAAB3NzaC1yc2EAAAADAQEL17Ufacg8cDhlQMS5NhV8z3GHZdhCrZbl4gz you@example.com
```
<!-- This redirect file can be deleted after <2021-08-13>. -->
<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
comments: false
redirect_to: '../../../topics/index.md'
---
# Git introduction
This document was removed. See our [topics](../../../topics/index.md) for similar content.
## Intro
<https://git-scm.com/about>
- Distributed version control
- Does not rely on connection to a central server
- Many copies of the complete history
- Powerful branching and merging
- Adapts to nearly any workflow
- Fast, reliable and stable file format
## Help
Use the tools at your disposal when you get stuck.
- Use '`git help <command>`' command
- Use Google
- Read documentation at <https://git-scm.com>
<!-- This redirect file can be deleted after <2021-08-13>. -->
<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->
---
redirect_to: '../../../topics/git/merge_requests.md'
redirect_to: '../../../user/project/merge_requests/index.md'
---
This document was moved to [another location](../../../topics/git/merge_requests.md).
This document was moved to [another location](../../../user/project/merge_requests/index.md).
<!-- This redirect file can be deleted after <2021-08-13>. -->
<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
comments: false
type: reference
redirect_to: '../../topics/index.md'
---
# GitLab Git Workshop
This document was removed. See our [topics](../../topics/index.md) for similar content.
## Agenda
1. Brief history of Git.
1. GitLab walkthrough.
1. Configure your environment.
1. Workshop.
## Git introduction
<https://git-scm.com/about>
- Distributed version control.
- Does not rely on connection to a central server.
- Many copies of the complete history.
- Powerful branching and merging.
- Adapts to nearly any workflow.
- Fast, reliable and stable file format.
## Help
Use the tools at your disposal when you get stuck.
- Use '`git help <command>`' command.
- Use Google.
- Read documentation at <https://git-scm.com>.
## GitLab Walkthrough
![fit](logo.png)
## Configure your environment
- Windows: Install 'Git for Windows'
> <https://gitforwindows.org>
- Mac: Type '`git`' in the Terminal application.
> If it's not installed, it prompts you to install it.
- Debian: '`sudo apt-get install git-all`' or Red Hat '`sudo yum install git-all`'
## Git Workshop
### Overview
1. Configure Git.
1. Configure SSH Key.
1. Create a project.
1. Committing.
1. Feature branching.
1. Merge requests.
1. Feedback and Collaboration.
## Configure Git
One-time configuration of the Git client:
```shell
git config --global user.name "Your Name"
git config --global user.email you@example.com
```
## Configure SSH Key
```shell
ssh-keygen -t rsa -b 4096 -C "you@computer-name"
```
```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):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/you/.ssh/id_rsa.
Your public key has been saved in /Users/you/.ssh/id_rsa.pub.
The key fingerprint is:
39:fc:ce:94:f4:09:13:95:64:9a:65:c1:de:05:4d:01 you@computer-name
```
Copy your public key and add it to your GitLab profile:
```shell
cat ~/.ssh/id_rsa.pub
```
```shell
ssh-rsa AAAAB3NzaC1yc2EAAAADAQEL17Ufacg8cDhlQMS5NhV8z3GHZdhCrZbl4gz you@example.com
```
## Create a project
- Create a project in your user namespace.
- Choose to import from **Any Repository by URL** and use <https://gitlab.com/gitlab-org/training-examples.git>.
- Create a '`development`' or '`workspace`' directory in your home directory.
- Clone the '`training-examples`' project.
## Commands (project)
```shell
mkdir ~/development
cd ~/development
-or-
mkdir ~/workspace
cd ~/workspace
git clone git@gitlab.example.com:<username>/training-examples.git
cd training-examples
```
## Git concepts
### Untracked files
New files that Git has not been told to track previously.
### Working area
Files that have been modified but are not committed.
### Staging area
Modified files that have been marked to go in the next commit.
## Committing
1. Edit '`edit_this_file.rb`' in '`training-examples`'.
1. See it listed as a changed file (working area).
1. View the differences.
1. Stage the file.
1. Commit.
1. Push the commit to the remote.
1. View the Git log.
## Commands (committing)
```shell
# Edit `edit_this_file.rb`
git status
git diff
git add <file>
git commit -m 'My change'
git push origin master
git log
```
## Feature branching
- Efficient parallel workflow for teams.
- Develop each feature in a branch.
- Keeps changes isolated.
- Consider a 1-to-1 link to issues.
- Push branches to the server frequently.
- Hint: This is a cheap backup for your work-in-progress code.
## Feature branching steps
1. Create a new feature branch called 'squash_some_bugs'.
1. Edit '`bugs.rb`' and remove all the bugs.
1. Commit.
1. Push.
## Commands (feature branching)
```shell
git checkout -b squash_some_bugs
# Edit `bugs.rb`
git status
git add bugs.rb
git commit -m 'Fix some buggy code'
git push origin squash_some_bugs
```
## Merge requests
- When you want feedback create a merge request.
- Target is the 'default' branch (usually master).
- Assign or mention the person you would like to review.
- Add `[Draft]` to the title if it's a work in progress.
- When accepting, always delete the branch.
- Anyone can comment, not just the assignee.
- Push corrections to the same branch.
## Merge requests steps
Create your first merge request:
1. Use the blue button in the activity feed.
1. View the diff (changes) and leave a comment.
1. Push a new commit to the same branch.
1. Review the changes again and notice the update.
## Feedback and Collaboration
- Merge requests are a time for feedback and collaboration.
- Giving feedback is hard.
- Be as kind as possible.
- Receiving feedback is hard.
- Be as receptive as possible.
- Feedback is about the best code, not the person. You are not your code.
## Feedback and Collaboration resources
<!-- vale gitlab.Spelling = NO -->
Review the Thoughtbot code-review guide for suggestions to follow when reviewing merge requests:
<https://github.com/thoughtbot/guides/tree/master/code-review>.
<!-- vale gitlab.Spelling = YES -->
See GitLab merge requests for examples: <https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests>.
## Explore GitLab projects
![fit](logo.png)
- Dashboard
- User Preferences
- README, Changelog, License shortcuts
- Issues
- Milestones and Labels
- Manage project members
- Project settings
## Tags
- Useful for marking deployments and releases.
- Annotated tags are an unchangeable part of Git history.
- Soft/lightweight tags can be set and removed at any time.
- Many projects combine an annotated release tag with a stable branch.
- Consider setting deployment/release tags automatically.
## Tags steps
1. Create a lightweight tag.
1. Create an annotated tag.
1. Push the tags to the remote repository.
Additional resources: <https://git-scm.com/book/en/v2/Git-Basics-Tagging>.
## Commands (tags)
```shell
git checkout master
# Lightweight tag
git tag my_lightweight_tag
# Annotated tag
git tag -a v1.0 -m 'Version 1.0'
git tag
git push origin --tags
```
## Merge conflicts
- Happen often.
- Learning to fix conflicts is hard.
- Practice makes perfect.
- Force push after fixing conflicts. Be careful!
## Merge conflicts steps
1. Checkout a new branch and edit `conflicts.rb`. Add 'Line4' and 'Line5'.
1. Commit and push.
1. Checkout master and edit `conflicts.rb`. Add 'Line6' and 'Line7' below 'Line3'.
1. Commit and push to master.
1. Create a merge request.
## Merge conflicts commands
After creating a merge request you should notice that conflicts exist. Resolve
the conflicts locally by rebasing.
```shell
git rebase master
# Fix conflicts by editing the files.
git add conflicts.rb
git commit -m 'Fix conflicts'
git rebase --continue
git push origin <branch> -f
```
## Rebase with squash
You may end up with a commit log that looks like this:
```plaintext
Fix issue #13
Test
Fix
Fix again
Test
Test again
Does this work?
```
Squash these in to meaningful commits using an interactive rebase.
## Rebase with squash commands
Squash the commits on the same branch we used for the merge conflicts step.
```shell
git rebase -i master
```
In the editor, leave the first commit as `pick` and set others to `fixup`.
## Questions?
![fit](logo.png)
Thank you for your hard work!
## Additional Resources
See [additional resources](index.md#additional-resources).
<!-- ## Troubleshooting
Include any troubleshooting steps that you can foresee. If you know beforehand what issues
one might have when setting this up, or when something is changed, or on upgrading, it's
important to describe those, too. Think of things that may go wrong and include them here.
This is important to minimize requests for support, and to avoid doc comments with
questions that you know someone might ask.
Each scenario can be a third-level heading, e.g. `### Getting error message X`.
If you have none to add when creating a doc, leave this section in place
but commented out to help encourage others to add to it in the future. -->
<!-- This redirect file can be deleted after <2021-08-13>. -->
<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->
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