Use the tools at your disposal when you get stuck.
git help <command>' command
git' in the Terminal application.
If it's not installed, it will prompt you to install it.
sudo apt-get install git-all' or Red Hat '
sudo yum install git-all'
One-time configuration of the Git client
git config --global user.name "Your Name" git config --global user.email [email protected]
ssh-keygen -t rsa -b 4096 -C "[email protected]"
# 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 [email protected]
Copy your public key and add it to your GitLab profile
ssh-rsa AAAAB3NzaC1yc2EAAAADAQEL17Ufacg8cDhlQMS5NhV8z3GHZdhCrZbl4gz [email protected]
development' or '
workspace' directory in your home directory.
mkdir ~/development cd ~/development -or- mkdir ~/workspace cd ~/workspace git clone [email protected]:<username>/training-examples.git cd training-examples
New files that Git has not been told to track previously.
Files that have been modified but are not committed.
Modified files that have been marked to go in the next commit.
edit_this_file.rb' in '
# Edit `edit_this_file.rb` git status git diff git add <file> git commit -m 'My change' git push origin master git log
bugs.rb' and remove all the bugs.
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
Create your first merge request
Review the Thoughtbot code-review guide for suggestions to follow when reviewing merge requests: https://github.com/thoughtbot/guides/tree/master/code-review
See GitLab merge requests for examples: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests
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
conflicts.rb. Add 'Line4' and 'Line5'.
conflicts.rb. Add 'Line6' and 'Line7' below 'Line3'.
After creating a merge request you should notice that conflicts exist. Resolve the conflicts locally by rebasing.
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
You may end up with a commit log that looks like this:
Fix issue #13 Test Fix Fix again Test Test again Does this work?
Squash these in to meaningful commits using an interactive rebase.
Squash the commits on the same branch we used for the merge conflicts step.
git rebase -i master
In the editor, leave the first commit as 'pick' and set others to 'fixup'.
Thank you for your hard work!
GitLab Documentation http://docs.gitlab.com GUI Clients http://git-scm.com/downloads/guis Pro git book http://git-scm.com/book Platzi Course https://courses.platzi.com/courses/git-gitlab/ Code School tutorial http://try.github.io/ Contact Us at