Github repo master branch

My computer

C1

C2

There is a master branch in my repo on GitHub
with two commits, C1 and C2

 

 

repo

Github repo master branch

My computer

C1

C2

C1

C2

When I clone the repo to my computer, I get the latest commits as well as the full history of changes

 

git clone https://github.com/userName/repoName.git
cd repoName

clone

Github repo master branch

My computer

C1

C2

C1

C2

My co-author Jared also clones the repo to his computer

 

Jared's computer

C1

C2

Github repo master branch

My computer

C1

C2

C1

C2

1. Open a file (let's say README)

2. Add changes

3. Save as usual

 

Jared's computer

C1

C2

C3

basic workflow (no branches)

Github repo master branch

My computer

C1

C2

C1

C2

1. Open a file (let's say README)

2. Add changes

3. Save as usual

4. stage the file

5. commit the change (with message)

Jared's computer

C1

C2

git add README.md
git commit -m "Update README.md"

C3

basic workflow (no branches)

Github repo master branch

My computer

C1

C2

C1

C2

push this change to GitHub

Jared's computer

C1

C2

git add README.md
git commit -m "Update README.md"
git pull
git push origin master

C3

C3

basic workflow (no branches)

(but remember, always pull first)

Github repo master branch

My computer

C1

C2

C1

C2

Jared pulls my changes from GitHub

Jared's computer

C1

C2

git pull origin

C3

C3

C3

basic workflow (no branches)

Github repo master branch

My computer

C1

C2

C1

C2

He adds a file, saves changes, then
stages & commits

Jared's computer

C1

C2

git pull origin
git add filename.do
git commit -m "Add data cleaning code"

C3

C3

C3

C4

basic workflow (no branches)

Github repo master branch

My computer

C1

C2

C1

C2

He then pushes these changes to GitHub

Jared's computer

C1

C2

git pull origin
git add filename.do
git commit -m "Add data cleaning code"
git pull
git push origin master

C3

C3

C3

C4

C4

basic workflow (no branches)

Github repo master branch

My computer

C1

C2

C1

C2

I can pull from the remote repo to get his changes

Jared's computer

C1

C2

git pull origin

C3

C3

C3

C4

C4

C4

basic workflow (no branches)

Github repo master branch

My computer

C1

C2

C1

C2

Jared's computer

C1

C2

C3

C3

C3

C4

C4

C4

So far, this is not that amazing

Dropbox mostly handles this without as much work

 

Note: this is also not the best workflow! More on that soon...

basic workflow (no branches)

Github repo master branch

My computer

C1

C2

C1

C2

Jared's computer

C1

C2

C3

C3

C3

C4

C4

C4

So far, this is not that amazing

Dropbox mostly handles this without as much work

 

But git is much better at handling conflicts than Dropbox

Git-animate

By Emilia Tjernström

Git-animate

  • 282