Starting with git and GitLabZeger-Jan van de Weg
What is git?
Version Control System
- Contains history of the codebase
- Directed graph state to all other states
- Offline
- But online single source of truth
- Distributed
- Using snapshots
● (I use the CLI exclusively recommend you to do the same)
Let’s get started
● Diverge from a chosen point in history
○ Isolates changes
○ Feature branches
○ git can track how to merge
Branching
New Branch
● $ git branch iss53
● $ git checkout iss53
After one commit
Another feature branch
● $ git checkout -b hotfix
● $ vim email.rb
● $ git commit -a -m ‘Fixed the broken email address’
Basic merge - Fast forward merging
● $ git checkout master
● $ git merge hotfix
Basic merge - Merge commit
● $ git checkout master
● $ git merge iss53
○ How does git resolve this?
Basic merge - Merge commit
● Cleanup:
○ $ git branch --delete iss53
Basic merge - Merge Conflicts
● What if multiple commits edit the same file?
○ Merge conflicts!
● Lets use the terminal again
Working together
● You need a source of truth
○ GitLab!
● First, let’s setup GitLab for our team
Working with Remotes
● $ git remote add [email protected]:group/project.git
● $ git push
○ $ git clone
Syncing changes
● Your changes to upstream
○ $ git push --set-upstream origin <branch-name>
● Pulling changes from upstream
○ $ git pull
●
Questions?
● Further reading:
○ ProGit
○ GitLab Flow
● Feature Proposals || Bugs
○ https://gitlab.com/gitlab-org/gitlab-ce/issues
● Email: [email protected]