1 of 39

By Jose Carlos Urra Llanusa

2 of 39

Black slides basic git

White slides (Workshop instructions)

3 of 39

I assume you join this workshop because

- You have difficulties in managing documentation across projects and you are looking for a better way to manage documentation effectively individually and in teams.

- You have heard about github and probably have used it, but you don’t really understand how to use it, why is it for, etc.

- You are learning or considering learning how to code.

- You are curious about open source maybe…

4 of 39

Or maybe just for ECTS?

5 of 39

is there another reason why you joined ?

6 of 39

Agenda for today

In the morning we will work with git version control locally and individually focusing on personal version control.

In the afternoon we will learn git as a collaborative tool and I will share some tips for project and workflow documentation, how I deal with projects using git.

+

7 of 39

Lets see some of the problems that can make our lives miserable as designers

8 of 39

9 of 39

10 of 39

If this is already a problem individually imagine what happens within a team

11 of 39

12 of 39

What is a Git? (according to Wiki)

Git (noun) : British for idiot. [see also: twat]

Git (computer-science) : a distributed version-control system for tracking changes in source code during software development.….but it can be used to track changes in any set of files.

13 of 39

What is a Git really?

a distributed version-control system for tracking changes in source code

14 of 39

What is NOT Git?

  • Command Line Black Magic
  • GitHub (platform)
  • GitLab (platform)
  • Complex (...ok, maybe at the start)
  • Scary (Only if you write empty stupid commit messages. Please don’t do that, ever)

15 of 39

16 of 39

Basic concepts

  • Repository is a directory/folder.
  • Tracking changes.
  • Commit as a snapshot of a repository.
  • Branching.
  • Merging.

17 of 39

Git 101

Terms you should understand:

  • Commit -------> record of changes
  • Repository ---> The complete history of commits for a particular project and their metadata

18 of 39

Command Line

# Save global credentials

$ git config --global user.name "Vlad Dracula"

$ git config --global user.email "vlad@tran.sylvan.ia"

# Create a new repository

$ git init

# Copy an existing repository

$ git clone <HTTP link of repo>

19 of 39

Command Line

# Information about repo

$ git status

$ git branch -a

# Adding changes

$ git add <filename1> <filename2> ...

$ git add . (adds everything in the current directory)

20 of 39

Command Line

# Adding changes

$ git commit -m “Commit Message”

$ git pull

$ git push

# Checking log

$ git log

$ git log --pretty=oneline

21 of 39

Command Line

# Checkout out / Branching

$ git checkout <branch name / commit ID / hash>

$ git checkout -b <new branch name>

$ git push --set-upstream origin <new branch name>

# After working on your branch:

$ git diff <branch name> #Shows all differences in each file

$ git push

22 of 39

Command Line

# Merging Branches and resolving conflicts

$ git checkout master

$ git merge <new branch name>

$ git branch -d <new branch name>

23 of 39

Command Line

# If merge fails:

  1. Cry
  2. Inspect which files are in conflict
  3. Manually make changes in the files
  4. Add all changes, commit merged version, push again to finish merging

24 of 39

Round 1: Lets try it out

  1. Install git.
  2. Install visual studio code (powerful editor).
  3. Let’s open our first repo.
  4. Lets copy some files of a project you are working on.
  5. Make some changes.
  6. First commit.

25 of 39

26 of 39

Round 2: Lets play with a .scad model in the editor

  • Install Openscad.
  • Lets go to thingiverse and pick up a model.
  • Add the file to your working folder.
  • Open Visual Studio Code.
  • Let's make a branch.
  • Open it with visual studio code and make some changes to certain variables in the code.
  • Lets also make a readme file in markdown.

27 of 39

Round 3: Lets document our project

  1. Create a markdown file in your working directory and call it Readme.md
  2. Lets make our first merge

28 of 39

Other things to consider with using git

  • You can use git client with more intuitive UI like Gitkraken or the git interface in editors like Atom and Visual Studio Code
  • Keep in mind that binary files (non code-text files) can be managed by git, but it cannot really compare differences between two files to do operations like merges.
  • In order to use binaries properly you need to use the LFS developed by github. Learn more about it here.

29 of 39

Open Source Collaboration

and Git hosting services

30 of 39

A bit of background and history on open source

31 of 39

My main motivations to study and work on open source projects

  • There are tons of resources and knowledge to learn from for free.
  • You learn by doing and hacking on top of what others have done.
  • I believe is smarter, more effective and fun.
  • I believe is more sustainable.
  • I think it can help to solve a lot of problems from economic empowerment to education and mass collaboration across the world.
  • It is more cost effective and inclusive compared to proprietary and closed services.
  • Innovations develop faster and are democratized faster.
  • Anyone has access to the core technologies that power the web today.

32 of 39

Github is a hosting service of git repositories to support collaboration like gitlab

33 of 39

Round 3: Git remotes and collaboration in gitlab

  1. Make a team of 2 or 3 persons.
  2. Configuring your git locally to work with remotes.
  3. Cloning and forking (differences).
  4. Creating a remote .
  5. Admin configuration: invite collaborators
  6. Adding a remote to your local git repository.
  7. Start making your own changes on your branch.
  8. Push your changes to the remote repo.
  9. Pull changes from other branches.
  10. Making merges directly on the remote (Pull requests).

34 of 39

Steps

  1. One person Create remote
  2. One person adds remote to current git repository
  3. Rest of the team clones the repository in a new folder

35 of 39

Key concepts

  1. Adding an origin.
  2. Pushing to the origin.
  3. Pulling from the origin.
  4. Version control of with merges on the origin.

36 of 39

Other things to consider when using git and remote repositories

  • You can also store your remotes in google drive or dropbox if you want to host private repos for free
  • Google Drive and git.
  • Dropbox and git.
  • Strategies, workflows and conventions to manage effectively git repos are also very important. Learn this by practicing.

37 of 39

Things we didn’t cover

  • Other version control systems for designers available.
  • How to manage conflicts when using binaries.
  • Conflict management.
  • Large File Storage(this is very important).
  • Conflict management with binaries.

38 of 39

Tutorials to learn git

39 of 39