Slide 1

Slide 1 text

Git 101 FreeFriday @ Teipir

Slide 2

Slide 2 text

Real quick...

Slide 3

Slide 3 text

Free Fridays Discuss about technology and stuff Learn new things and stay up-to-date Get better at what we do Enrich our education

Slide 4

Slide 4 text

Dimitris Tsironis Front-end Engineer at BugSense, JavaScript lover || hater, Open-source & (Coffee)Script addict, Technology afficcionado

Slide 5

Slide 5 text

Source Control Management Keep your code organized in repositories Enhance contributing Source versioning

Slide 6

Slide 6 text

Git Distributed Version Control System (DVCS)

Slide 7

Slide 7 text

Git Created by Linus Torvalds [2005] Written (mostly) in C and Shell

Slide 8

Slide 8 text

Why distributed? Every developer gets a copy of the repo Make your contributions really fast Work offline

Slide 9

Slide 9 text

Git installation sudo apt-get install git [Ubuntu] brew install git [OSX] http://bit.ly/14Gqzyp [Windows]

Slide 10

Slide 10 text

Creating a repository $ mkdir -p ~/gitff/lecture1 $ cd ~/gitff/lecture1 $ git init

Slide 11

Slide 11 text

Now your folder is a git repository

Slide 12

Slide 12 text

Start coding! or whatever

Slide 13

Slide 13 text

Write some code Create a text file (touch readme.txt) Add your name inside the file

Slide 14

Slide 14 text

Cool story bro! but how can I update my repo?

Slide 15

Slide 15 text

Commit A set of changes

Slide 16

Slide 16 text

The staging area All the modified/added/deleted files that are going to be commited

Slide 17

Slide 17 text

git status # On branch master # # Initial commit # # Untracked files: # (use "git add ..." to include in what will be committed) # # readme.txt nothing added to commit but untracked files present (use "git add" to track)

Slide 18

Slide 18 text

Add readme to stage git add readme.txt This command adds readme.txt (or changes in readme.txt) to staging area

Slide 19

Slide 19 text

Alternative adding all files to stage git add --all This command adds (add) all (deleted/ created/modified) files to staging area

Slide 20

Slide 20 text

git status # On branch master # # Initial commit # # Changes to be committed: # (use "git rm --cached ..." to unstage) # # new file: readme.txt #

Slide 21

Slide 21 text

Commit changes git commit -m “Initial Commit” This command creates the commit containing the staged changes

Slide 22

Slide 22 text

Now add your email to readme.txt

Slide 23

Slide 23 text

How can I get my code to the web?

Slide 24

Slide 24 text

Github (Hosted) Bitbucket (Hosted) GitLab (Private) And may others

Slide 25

Slide 25 text

Github a web-based hosting service for software development projects that use Git Written in Ruby on Rails and Erlang Running since 2008

Slide 26

Slide 26 text

Creating a new Github Repository

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

The remote (origin) The git path to remote repository (usually called origin)

Slide 30

Slide 30 text

Add remote to local repository git remote add origin your_remote This command adds a remote to a remote repository

Slide 31

Slide 31 text

git remote -v Show my remotes

Slide 32

Slide 32 text

Push pushing commits to remote repository

Slide 33

Slide 33 text

Push changes to remote repository git push origin master We will only use master branch for the time being

Slide 34

Slide 34 text

Pull pulling commits from remote repository

Slide 35

Slide 35 text

Pull changes from remote repository git pull origin master We will only use master branch for the time being

Slide 36

Slide 36 text

Clone Get a copy of a repository

Slide 37

Slide 37 text

Cloning a repository $ cd $ git clone https://github.com/FreeFriday/ my_first_repo.git angels_first_repo $ cd angels_first_repo $ ls -l

Slide 38

Slide 38 text

Thanks! @tsironakos