Working with others in git

throwing toys from pram to pram

Andy Balaam
artificialworlds.net/blog

Contents

Cloning

get the code

Cloning

Cloning

To get the code:

$ git clone https://github.com/andybalaam/pepper.git
Cloning into 'pepper'...
remote: Counting objects: 3935, done.
remote: Compressing objects: 100% (1568/1568), done.
remote: Total 3935 (delta 2745), reused 3463 (delta 2273)
Receiving objects: 100% (3935/3935), 543.63 KiB | 457 KiB/s, done.
Resolving deltas: 100% (2745/2745), done.

Cloning

$ cd pepper
$ cat README.txt 
The Pepper Programming Language

Pepper is a ficticious multi-paradigm programming language.

See http://www.artificialworlds.net/pepper for more information.

Cloning

$ git branch
* master

$ git branch -r
  origin/HEAD -> origin/master
  origin/master

$ git remote
origin

Cloning

To keep up to date:

$ git fetch
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From https://github.com/andybalaam/pepper.git
   16d9efa..40127fe  master     -> origin/master

Now your mirror is up to date...

Cloning

To get the updates in your local branch:

$ git merge origin
Updating 16d9efa..40127fe
Fast-forward
 README.txt |    1 +
 1 file changed, 1 insertion(+)

Cloning

To fetch and merge at the same time:

$ git pull
Updating 16d9efa..40127fe
Fast-forward
 README.txt |    1 +
 1 file changed, 1 insertion(+)

Sending patches

suggest something

Sending patches

$ vim README.txt
README.txt
The Pepper Programming Language

Pepper is ficticious multi-paradigm programming language.

See http://www.artificialworlds.net/pepper for more information.

Sending patches

$ git commit -a -m "Make it REAL"
[master f96d6ae] Make it REAL
 1 file changed, 1 insertion(+), 1 deletion(-)

$ git format-patch HEAD^
0001-Make-it-REAL.patch

Sending patches

$ vim 0001-Make-it-REAL.patch
0001-Make-it-REAL.patch
From f96d6ae0d58e01e6f5c28030c387f0de9107d642 Mon Sep 17 00:00:00 2001
From: Andy Balaam <andybalaam@artificialworlds.net>
Date: Thu, 18 Jul 2013 17:10:44 +0100
Subject: [PATCH] Make it REAL

---
 README.txt |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.txt b/README.txt
...

Forking

get involved

Forking

Forking

You committed some local changes:

$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)

Forking

Send them to your public clone:

$ git push
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 291 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
To https://github.com/andybalaam/pepper.git
   40127fe..4e82cfe  master -> master

Forking

Now everything is up to date:

$ git status
# On branch master
nothing to commit (working directory clean)

Forking

Now you make a pull request, using:

If the owner of the other repo likes your change, she will:

More info

Videos youtube.com/user/ajbalaam
Twitter @andybalaam
Blog artificialworlds.net/blog
Projects artificialworlds.net