SlideShare a Scribd company logo
1 of 33
Download to read offline
GIT
GOOD PRACTICES	
  

                Rodolfo	
  Spalenza	
   	
  

                     @rodolfospalenza	
        	
  



                      rodolfospalenza	
  
#1 FORK	
  
#1 FORK	
  
#2 CLONE	
  


 ~ $ git clone git@github.com:rodolfospalenza/ancestry.git
 Cloning into 'ancestry'...
 remote: Counting objects: 485, done.
 remote: Compressing objects: 100% (241/241), done.
 Receiving objects: 99% (481/485), 956.00 KiB | 27 KiB/s
 remote: Total 485 (delta 282), reused 411 (delta 222)
 Receiving objects: 100% (485/485), 8.29 MiB | 34 KiB/s,
 done.
 Resolving deltas: 100% (282/282), done.
#3 REMOTE	
  
 ~/ancestry [master] $ git remote –v
 origin git@github.com:rodolfospalenza/ancestry.git (fetch)
 origin git@github.com:rodolfospalenza/ancestry.git (push)



 ~/ancestry [master] $ git remote add upstream git://
 github.com/stefankroes/ancestry.git



 ~/ancestry [master] $ git remote -v
 origin git@github.com:rodolfospalenza/ancestry.git (fetch)
 origin git@github.com:rodolfospalenza/ancestry.git (push)
 upstream git://github.com/stefankroes/ancestry.git
 (fetch)
 upstream git://github.com/stefankroes/ancestry.git (push)
#4 FETCH	
  

   ~/ancestry [master] $ git fetch origin master
   From github.com:rodolfospalenza/ancestry
    * branch            master     -> FETCH_HEAD




   ~/ancestry [master] $ git fetch upstream master
   From git://github.com/stefankroes/ancestry
    * branch            master     -> FETCH_HEAD
#5 REPOSITORIES	
  




   LOCAL	
     ORIGIN	
     UPSTREAM	
  
#6 COMMIT	
  

    ~/ancestry [master] $ touch new_file.rb
    ~/ancestry [master] $ git status
    # On branch master
    # Untracked files:
    #   (use "git add <file>..." to include in what
    will be committed)
    #
    # new_file.rb
    nothing added to commit but untracked files
    present (use "git add" to track)
#6 COMMIT	
  
   ~/ancestry [master] $ git add .
   ~/ancestry [master] $ git status
   # On branch master
   # Changes to be committed:
   #   (use "git reset HEAD <file>..." to unstage)
   #
   # new file:    new_file.rb
   #




   ~/ancestry [master] $ git commit -m "New file."
   [master 248a8a4] New file.
    0 files changed
    create mode 100644 new_file.rb
#7 REBASE	
  
  ~/ancestry [master] $ git fetch upstream
  From git://github.com/stefankroes/ancestry
   * [new branch]      1-3-stable -> upstream/1-3-stable
   * [new branch]      gh-pages   -> upstream/gh-pages
   * [new branch]      master     -> upstream/master
   * [new branch]      rails3     -> upstream/rails3
  From git://github.com/stefankroes/ancestry
   * branch            master     -> FETCH_HEAD



  ~/ancestry [master] $ git rebase upstream/master
  master
  Already on 'master'
  Current branch master is up to date.
#8 PUSH	
  
    ~/ancestry [master] $ git push origin master
    Counting objects: 4, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (2/2), done.
    Writing objects: 100% (3/3), 284 bytes, done.
    Total 3 (delta 1), reused 0 (delta 0)
    To git@github.com:rodolfospalenza/ancestry.git
       39f00ab..248a8a4 master -> master
#9 PULL REQUEST	
  
#9 PULL REQUEST	
  
#10 REBASE VS. PULL	
  
                                                      USER 01	
  


 ~/ancestry [master] $ git log --graph
 * commit bbf1e7e177f0a86f635c41b6181f1694a71492ce
 | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com>
 | Date:   Tue Dec 11 21:52:47 2012 -0200
 |
 |     Add new file.
 |
 * commit 39f00abbbca1e6e90b1a268e918342b6950812c5
 | Author: Stefan Henzen <s.f.henzen@nedforce.nl>
 | Date:   Fri Jun 29 14:50:18 2012 +0200
 |
 |     fix readme, small fix in restore_ancestry_integrity!
#10 REBASE VS. PULL	
  
                                                    USER 01	
  




   ~/ancestry [master] $ git push origin master
   Counting objects: 4, done.
   Delta compression using up to 4 threads.
   Compressing objects: 100% (3/3), done.
   Writing objects: 100% (3/3), 614 bytes, done.
   Total 3 (delta 1), reused 0 (delta 0)
   To git@github.com:rodolfospalenza/ancestry.git
      39f00ab..bbf1e7e master -> master
#10 REBASE VS. PULL	
  
                                                      USER 02	
  


 ~/ancestry [master] $ git log --graph
 * commit 5310b92074cde08673a622a476ee95edd98cd387
 | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com>
 | Date:   Tue Dec 11 21:52:47 2012 -0200
 |
 |     Add old file.
 |
 * commit 39f00abbbca1e6e90b1a268e918342b6950812c5
 | Author: Stefan Henzen <s.f.henzen@nedforce.nl>
 | Date:   Fri Jun 29 14:50:18 2012 +0200
 |
 |     fix readme, small fix in restore_ancestry_integrity!
#10 REBASE VS. PULL	
  
                                                     USER 02	
  




 ~/ancestry [master] $ git push origin master
 To git@github.com:rodolfospalenza/ancestry.git
  ! [rejected]        master -> master (non-fast-forward)
 error: failed to push some refs to
 'git@github.com:rodolfospalenza/ancestry.git'
 hint: Updates were rejected because the tip of your
 current branch is behind
 hint: its remote counterpart. Merge the remote changes
 (e.g. 'git pull')
 hint: before pushing again.
#10 REBASE VS. PULL	
  
                                                     USER 02	
  




    ~/ancestry [master] $ git pull origin master
    remote: Counting objects: 4, done.
    remote: Compressing objects: 100% (2/2), done.
    remote: Total 3 (delta 1), reused 3 (delta 1)
    Unpacking objects: 100% (3/3), done.
    From github.com:rodolfospalenza/ancestry
     * branch            master     -> FETCH_HEAD
    Merge made by the 'recursive' strategy.
     new_file | 1 +
     1 file changed, 1 insertion(+)
     create mode 100644 new_file
#10 REBASE VS. PULL	
  
                                                                        USER 02	
  
 ~/ancestry [master] $ git log --graph
 *   commit 7a85d5c39575dec335a86ed936c2c6a949b51de0
 | Merge: 5310b92 bbf1e7e
 | | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com>
 | | Date:   Tue Dec 11 22:06:49 2012 -0200
 | |
 | |     Merge branch 'master' of github.com:rodolfospalenza/ancestry
 | |
 | * commit bbf1e7e177f0a86f635c41b6181f1694a71492ce
 | | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com>
 | | Date:   Tue Dec 11 21:52:47 2012 -0200
 | |
 | |     Add new file.
 | |
 * | commit 5310b92074cde08673a622a476ee95edd98cd387
 |/ Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com>
 |   Date:   Tue Dec 11 22:02:54 2012 -0200
 |
 |       Add old file.
 |
 * commit 39f00abbbca1e6e90b1a268e918342b6950812c5
 | Author: Stefan Henzen <s.f.henzen@nedforce.nl>
 | Date:   Fri Jun 29 14:50:18 2012 +0200
 |
 |     fix readme, small fix in restore_ancestry_integrity!
#10 REBASE VS. PULL	
  
                            MERGE	
  




 COMMIT	
  USER	
  01	
                 COMMIT	
  USER	
  02	
  
#10 REBASE VS. PULL	
  
#10 REBASE VS. PULL	
  
                                                    USER 02	
  


    ~/ancestry [master] $ git fetch origin
    From github.com:rodolfospalenza/ancestry
       39f00ab..bbf1e7e master      -> origin/
    master




 ~/ancestry [master] $ git rebase origin/master master
 First, rewinding head to replay your work on top of
 it...
 Applying: Add old file.
#10 REBASE VS. PULL	
  
                                                           USER 02	
  


  ~/ancestry [master] $ git log --graph
  * commit c765729377be06ecba78e3dd110a66f348699475
  | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com>
  | Date:   Tue Dec 11 22:16:26 2012 -0200
  |
  |     Add old file.
  |
  * commit bbf1e7e177f0a86f635c41b6181f1694a71492ce
  | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com>
  | Date:   Tue Dec 11 21:52:47 2012 -0200
  |
  |     Add new file.
  |
  * commit 39f00abbbca1e6e90b1a268e918342b6950812c5
  | Author: Stefan Henzen <s.f.henzen@nedforce.nl>
  | Date:   Fri Jun 29 14:50:18 2012 +0200
  |
  |     fix readme, small fix in restore_ancestry_integrity!
#10 REBASE VS. PULL	
  
                                                    USER 02	
  



   ~/ancestry [master] $ git push origin master
   Counting objects: 3, done.
   Delta compression using up to 4 threads.
   Compressing objects: 100% (2/2), done.
   Writing objects: 100% (2/2), 250 bytes, done.
   Total 2 (delta 1), reused 0 (delta 0)
   To git@github.com:rodolfospalenza/ancestry.git
      bbf1e7e..c765729 master -> master
#11 AMENDED COMMIT 	
  

 ~/ancestry [master] $ git log --graph
 * commit c765729377be06ecba78e3dd110a66f348699475
 | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com>
 | Date:   Tue Dec 11 22:16:26 2012 -0200
 |
 |     Add old file.
 |




  ~/ancestry [master] $ git add .
  ~/ancestry [master] $ git commit --amend
#11 AMENDED COMMIT 	
  
  1 Add old file.
  2
  3 # Please enter the commit message for your changes.
 Lines starting
  4 # with '#' will be ignored, and an empty message
 aborts the commit.
  5 # On branch master
  6 # Changes to be committed:
  7 #   (use "git reset HEAD^1 <file>..." to unstage)
  8 #
  9 #   new file:   old_file
 10 #
#11 AMENDED COMMIT 	
  


  ~/ancestry [master] $ git log --graph
  * commit e1dbf27ef62cef023437a710f5101dbf762efbef
  | Author: Rodolfo Spalenza
  <rodolfo.spalenza@gmail.com>
  | Date:   Tue Dec 11 22:16:26 2012 -0200
  |
  |     Add old file.
  |
#12 INTERACTIVE REBASE	
  
  ~/ancestry [master] $ git log --graph
  * commit 3c8464613ce94ff78372ce5c0fbf049d2fa5524e
  | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com>
  | Date:   Tue Dec 11 22:51:10 2012 -0200
  |
  |     Add example file.
  |
  * commit e1dbf27ef62cef023437a710f5101dbf762efbef
  | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com>
  | Date:   Tue Dec 11 22:16:26 2012 -0200
  |
  |     Add old file.
  |




  ~/ancestry [master] $ git rebase –i HEAD~3
#12 INTERACTIVE REBASE	
  
  1   pick bbf1e7e Add new file.
  2   r e1dbf27 Add old file.
  3   f 3c84646 Add example file.
  4
  5   #   Rebase 39f00ab..3c84646 onto 39f00ab
  6   #
  7   #   Commands:
  8   #    p, pick = use commit
  9   #    r, reword = use commit, but edit the commit message
 10   #    e, edit = use commit, but stop for amending
 11   #    s, squash = use commit, but meld into previous commit
 12   #    f, fixup = like "squash", but discard this commit's log message
 13   #    x, exec = run command (the rest of the line) using shell
 14   #
 15   #   These lines can be re-ordered; they are executed from top to bottom.
 16   #
 17   #   If you remove a line here THAT COMMIT WILL BE LOST.
 18   #   However, if you remove everything, the rebase will be aborted.
 19   #
 20   #   Note that empty commits are commented out
#12 INTERACTIVE REBASE	
  
  1 Add old file with rebase.
  2
  3 # Please enter the commit message for your changes.
 Lines starting
  4 # with '#' will be ignored, and an empty message
 aborts the commit.
  5 # Not currently on any branch.
  6 # You are currently editing a commit during a rebase.
  7
  8 # Changes to be committed:
  9 #   (use "git reset HEAD^1 <file>..." to unstage)
 10 #
 11 #   new file:   old_file
 12 #
#12 INTERACTIVE REBASE	
  


  ~/ancestry [master] $ git rebase –i HEAD~3
  [detached HEAD e2afa36] Add old file with rebase.
   1 file changed, 3 insertions(+)
   create mode 100644 old_file
  [detached HEAD 952118d] Add old file with rebase.
   2 files changed, 4 insertions(+)
   create mode 100644 example
   create mode 100644 old_file
  Successfully rebased and updated refs/heads/master.
#12 INTERACTIVE REBASE	
  

  ~/ancestry [master] $ git log --graph
  * commit 952118d7fb53a33040f50707053ee1499f0728b9
  | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com>
  | Date:   Tue Dec 11 22:16:26 2012 -0200
  |
  |     Add old file with rebase.
  |
  * commit Tue Dec 11 21:52:47 2012 -0200
  | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com>
  | Date:   Tue Dec 11 22:16:26 2012 -0200
  |
  |     Add new file.
  |
REFERENCES	
  
h<ps://help.github.com/arGcles/fork-­‐a-­‐repo	
  
h<p://git-­‐scm.com/book/en/Git-­‐Branching-­‐Rebasing	
  

h<p://learn.github.com/p/rebasing.html	
  

h<p://blip.tv/akitaonrails/screencast-­‐come-­‐ando-­‐com-­‐
git-­‐6074964	
  

More Related Content

What's hot

Git Developer Cheatsheet
Git Developer CheatsheetGit Developer Cheatsheet
Git Developer Cheatsheet
Abdul Basit
 
Git flow for daily use
Git flow for daily useGit flow for daily use
Git flow for daily use
Mediacurrent
 
Checkitmobile - using Git for development
Checkitmobile - using Git for developmentCheckitmobile - using Git for development
Checkitmobile - using Git for development
Gerrit Wanderer
 
Checkitmobile advanced git
Checkitmobile advanced gitCheckitmobile advanced git
Checkitmobile advanced git
Gerrit Wanderer
 

What's hot (20)

Git Developer Cheatsheet
Git Developer CheatsheetGit Developer Cheatsheet
Git Developer Cheatsheet
 
Git github
Git githubGit github
Git github
 
Git flow for daily use
Git flow for daily useGit flow for daily use
Git flow for daily use
 
Version Control Systems with git (and github) as an example
Version Control Systems with git (and github) as an exampleVersion Control Systems with git (and github) as an example
Version Control Systems with git (and github) as an example
 
Git SCM
Git SCMGit SCM
Git SCM
 
Git Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierGit Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easier
 
Git-ing out of your git messes
Git-ing out of  your git messesGit-ing out of  your git messes
Git-ing out of your git messes
 
git - the basics
git - the basicsgit - the basics
git - the basics
 
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
 
The Fundamentals of Git
The Fundamentals of GitThe Fundamentals of Git
The Fundamentals of Git
 
Advanced Git
Advanced GitAdvanced Git
Advanced Git
 
Git: basic to advanced
Git: basic to advancedGit: basic to advanced
Git: basic to advanced
 
From svn to git
From svn to gitFrom svn to git
From svn to git
 
Honestly Git Playground 20190221
Honestly Git Playground 20190221Honestly Git Playground 20190221
Honestly Git Playground 20190221
 
Git
GitGit
Git
 
Gittalk
GittalkGittalk
Gittalk
 
Git Basics at Rails Underground
Git Basics at Rails UndergroundGit Basics at Rails Underground
Git Basics at Rails Underground
 
Checkitmobile Git Workshop
Checkitmobile Git WorkshopCheckitmobile Git Workshop
Checkitmobile Git Workshop
 
Checkitmobile - using Git for development
Checkitmobile - using Git for developmentCheckitmobile - using Git for development
Checkitmobile - using Git for development
 
Checkitmobile advanced git
Checkitmobile advanced gitCheckitmobile advanced git
Checkitmobile advanced git
 

Viewers also liked

Tgs. p erbedaan bahasa indonesia dengan bahasa melayu.artayahonest
Tgs. p erbedaan bahasa indonesia dengan bahasa melayu.artayahonestTgs. p erbedaan bahasa indonesia dengan bahasa melayu.artayahonest
Tgs. p erbedaan bahasa indonesia dengan bahasa melayu.artayahonest
Artaya Honest
 
Softskill (telkom)
Softskill (telkom)Softskill (telkom)
Softskill (telkom)
Fauzan Agam
 
Manajemen jaringan server c kelompok 4-artayahonest
Manajemen jaringan server c   kelompok 4-artayahonestManajemen jaringan server c   kelompok 4-artayahonest
Manajemen jaringan server c kelompok 4-artayahonest
Artaya Honest
 
Tgs. p erbedaan bahasa indonesia dengan bahasa melayu.artayahonest
Tgs. p erbedaan bahasa indonesia dengan bahasa melayu.artayahonestTgs. p erbedaan bahasa indonesia dengan bahasa melayu.artayahonest
Tgs. p erbedaan bahasa indonesia dengan bahasa melayu.artayahonest
Artaya Honest
 
Simply me! --edu1103
Simply me!  --edu1103Simply me!  --edu1103
Simply me! --edu1103
BrieHoover
 
Grammar book
Grammar bookGrammar book
Grammar book
annpear
 
Favorite tv shows in the herzog home
Favorite tv shows in the herzog homeFavorite tv shows in the herzog home
Favorite tv shows in the herzog home
stephanieherzog72
 
Pengertian algoritma lengkap by.artayahonest
Pengertian algoritma lengkap by.artayahonestPengertian algoritma lengkap by.artayahonest
Pengertian algoritma lengkap by.artayahonest
Artaya Honest
 
Glacier National Park Vacation
Glacier National Park VacationGlacier National Park Vacation
Glacier National Park Vacation
lnystrom
 
Grammar book 2
Grammar book 2Grammar book 2
Grammar book 2
annpear
 
Edu ppt
Edu pptEdu ppt
Edu ppt
ashzx3
 

Viewers also liked (19)

G sockey
G sockeyG sockey
G sockey
 
Tgs. p erbedaan bahasa indonesia dengan bahasa melayu.artayahonest
Tgs. p erbedaan bahasa indonesia dengan bahasa melayu.artayahonestTgs. p erbedaan bahasa indonesia dengan bahasa melayu.artayahonest
Tgs. p erbedaan bahasa indonesia dengan bahasa melayu.artayahonest
 
Softskill (telkom)
Softskill (telkom)Softskill (telkom)
Softskill (telkom)
 
Nisto Cremos Capítulo 27
Nisto Cremos Capítulo 27Nisto Cremos Capítulo 27
Nisto Cremos Capítulo 27
 
Manajemen jaringan server c kelompok 4-artayahonest
Manajemen jaringan server c   kelompok 4-artayahonestManajemen jaringan server c   kelompok 4-artayahonest
Manajemen jaringan server c kelompok 4-artayahonest
 
Tgs. p erbedaan bahasa indonesia dengan bahasa melayu.artayahonest
Tgs. p erbedaan bahasa indonesia dengan bahasa melayu.artayahonestTgs. p erbedaan bahasa indonesia dengan bahasa melayu.artayahonest
Tgs. p erbedaan bahasa indonesia dengan bahasa melayu.artayahonest
 
Simply me! --edu1103
Simply me!  --edu1103Simply me!  --edu1103
Simply me! --edu1103
 
Grammar book
Grammar bookGrammar book
Grammar book
 
Unit 2 completed
Unit 2 completedUnit 2 completed
Unit 2 completed
 
Dev
DevDev
Dev
 
Favorite tv shows in the herzog home
Favorite tv shows in the herzog homeFavorite tv shows in the herzog home
Favorite tv shows in the herzog home
 
Pengertian algoritma lengkap by.artayahonest
Pengertian algoritma lengkap by.artayahonestPengertian algoritma lengkap by.artayahonest
Pengertian algoritma lengkap by.artayahonest
 
Vuit criteris claus d'intervenció educativa
Vuit criteris claus d'intervenció educativaVuit criteris claus d'intervenció educativa
Vuit criteris claus d'intervenció educativa
 
Glacier National Park Vacation
Glacier National Park VacationGlacier National Park Vacation
Glacier National Park Vacation
 
Development power point.
Development power point.Development power point.
Development power point.
 
Lease clinic space
Lease clinic spaceLease clinic space
Lease clinic space
 
Grammar book 2
Grammar book 2Grammar book 2
Grammar book 2
 
My Talk to The Integrated Marketing Class at NYU (April 28, 2014)
My Talk to The Integrated Marketing Class at NYU (April 28, 2014)My Talk to The Integrated Marketing Class at NYU (April 28, 2014)
My Talk to The Integrated Marketing Class at NYU (April 28, 2014)
 
Edu ppt
Edu pptEdu ppt
Edu ppt
 

Similar to GIT - GOOD PRACTICES

Gitosis on Mac OS X Server
Gitosis on Mac OS X ServerGitosis on Mac OS X Server
Gitosis on Mac OS X Server
Yasuhiro Asaka
 
GIT rozproszony system kontroli wersji
GIT rozproszony system kontroli wersjiGIT rozproszony system kontroli wersji
GIT rozproszony system kontroli wersji
3camp
 

Similar to GIT - GOOD PRACTICES (20)

Git real slides
Git real slidesGit real slides
Git real slides
 
Git_real_slides
Git_real_slidesGit_real_slides
Git_real_slides
 
Introducción a git y GitHub
Introducción a git y GitHubIntroducción a git y GitHub
Introducción a git y GitHub
 
Gitosis on Mac OS X Server
Gitosis on Mac OS X ServerGitosis on Mac OS X Server
Gitosis on Mac OS X Server
 
Git Concepts, Commands and Connectivity
Git Concepts, Commands and ConnectivityGit Concepts, Commands and Connectivity
Git Concepts, Commands and Connectivity
 
git internals
git internalsgit internals
git internals
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
 
Version Control with Git
Version Control with GitVersion Control with Git
Version Control with Git
 
GIT rozproszony system kontroli wersji
GIT rozproszony system kontroli wersjiGIT rozproszony system kontroli wersji
GIT rozproszony system kontroli wersji
 
Version Control with Git for Beginners
Version Control with Git for BeginnersVersion Control with Git for Beginners
Version Control with Git for Beginners
 
GIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control SystemGIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control System
 
Git Basics (Professionals)
 Git Basics (Professionals) Git Basics (Professionals)
Git Basics (Professionals)
 
Get going with_git_ppt
Get going with_git_pptGet going with_git_ppt
Get going with_git_ppt
 
Did you git yet?
Did you git yet?Did you git yet?
Did you git yet?
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
Sacándole jugo a git
Sacándole jugo a gitSacándole jugo a git
Sacándole jugo a git
 
Git internals
Git internalsGit internals
Git internals
 
Get Good With Git
Get Good With GitGet Good With Git
Get Good With Git
 
Git For Beginer
Git For BeginerGit For Beginer
Git For Beginer
 
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
Nicola Iarocci - Git stories from the front line - Codemotion Milan 2017
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Recently uploaded (20)

ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 

GIT - GOOD PRACTICES

  • 1. GIT GOOD PRACTICES   Rodolfo  Spalenza     @rodolfospalenza     rodolfospalenza  
  • 4. #2 CLONE   ~ $ git clone git@github.com:rodolfospalenza/ancestry.git Cloning into 'ancestry'... remote: Counting objects: 485, done. remote: Compressing objects: 100% (241/241), done. Receiving objects: 99% (481/485), 956.00 KiB | 27 KiB/s remote: Total 485 (delta 282), reused 411 (delta 222) Receiving objects: 100% (485/485), 8.29 MiB | 34 KiB/s, done. Resolving deltas: 100% (282/282), done.
  • 5. #3 REMOTE   ~/ancestry [master] $ git remote –v origin git@github.com:rodolfospalenza/ancestry.git (fetch) origin git@github.com:rodolfospalenza/ancestry.git (push) ~/ancestry [master] $ git remote add upstream git:// github.com/stefankroes/ancestry.git ~/ancestry [master] $ git remote -v origin git@github.com:rodolfospalenza/ancestry.git (fetch) origin git@github.com:rodolfospalenza/ancestry.git (push) upstream git://github.com/stefankroes/ancestry.git (fetch) upstream git://github.com/stefankroes/ancestry.git (push)
  • 6. #4 FETCH   ~/ancestry [master] $ git fetch origin master From github.com:rodolfospalenza/ancestry * branch master -> FETCH_HEAD ~/ancestry [master] $ git fetch upstream master From git://github.com/stefankroes/ancestry * branch master -> FETCH_HEAD
  • 7. #5 REPOSITORIES   LOCAL   ORIGIN   UPSTREAM  
  • 8. #6 COMMIT   ~/ancestry [master] $ touch new_file.rb ~/ancestry [master] $ git status # On branch master # Untracked files: # (use "git add <file>..." to include in what will be committed) # # new_file.rb nothing added to commit but untracked files present (use "git add" to track)
  • 9. #6 COMMIT   ~/ancestry [master] $ git add . ~/ancestry [master] $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: new_file.rb # ~/ancestry [master] $ git commit -m "New file." [master 248a8a4] New file. 0 files changed create mode 100644 new_file.rb
  • 10. #7 REBASE   ~/ancestry [master] $ git fetch upstream From git://github.com/stefankroes/ancestry * [new branch] 1-3-stable -> upstream/1-3-stable * [new branch] gh-pages -> upstream/gh-pages * [new branch] master -> upstream/master * [new branch] rails3 -> upstream/rails3 From git://github.com/stefankroes/ancestry * branch master -> FETCH_HEAD ~/ancestry [master] $ git rebase upstream/master master Already on 'master' Current branch master is up to date.
  • 11. #8 PUSH   ~/ancestry [master] $ git push origin master Counting objects: 4, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 284 bytes, done. Total 3 (delta 1), reused 0 (delta 0) To git@github.com:rodolfospalenza/ancestry.git 39f00ab..248a8a4 master -> master
  • 14. #10 REBASE VS. PULL   USER 01   ~/ancestry [master] $ git log --graph * commit bbf1e7e177f0a86f635c41b6181f1694a71492ce | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com> | Date: Tue Dec 11 21:52:47 2012 -0200 | | Add new file. | * commit 39f00abbbca1e6e90b1a268e918342b6950812c5 | Author: Stefan Henzen <s.f.henzen@nedforce.nl> | Date: Fri Jun 29 14:50:18 2012 +0200 | | fix readme, small fix in restore_ancestry_integrity!
  • 15. #10 REBASE VS. PULL   USER 01   ~/ancestry [master] $ git push origin master Counting objects: 4, done. Delta compression using up to 4 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 614 bytes, done. Total 3 (delta 1), reused 0 (delta 0) To git@github.com:rodolfospalenza/ancestry.git 39f00ab..bbf1e7e master -> master
  • 16. #10 REBASE VS. PULL   USER 02   ~/ancestry [master] $ git log --graph * commit 5310b92074cde08673a622a476ee95edd98cd387 | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com> | Date: Tue Dec 11 21:52:47 2012 -0200 | | Add old file. | * commit 39f00abbbca1e6e90b1a268e918342b6950812c5 | Author: Stefan Henzen <s.f.henzen@nedforce.nl> | Date: Fri Jun 29 14:50:18 2012 +0200 | | fix readme, small fix in restore_ancestry_integrity!
  • 17. #10 REBASE VS. PULL   USER 02   ~/ancestry [master] $ git push origin master To git@github.com:rodolfospalenza/ancestry.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'git@github.com:rodolfospalenza/ancestry.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Merge the remote changes (e.g. 'git pull') hint: before pushing again.
  • 18. #10 REBASE VS. PULL   USER 02   ~/ancestry [master] $ git pull origin master remote: Counting objects: 4, done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 1), reused 3 (delta 1) Unpacking objects: 100% (3/3), done. From github.com:rodolfospalenza/ancestry * branch master -> FETCH_HEAD Merge made by the 'recursive' strategy. new_file | 1 + 1 file changed, 1 insertion(+) create mode 100644 new_file
  • 19. #10 REBASE VS. PULL   USER 02   ~/ancestry [master] $ git log --graph * commit 7a85d5c39575dec335a86ed936c2c6a949b51de0 | Merge: 5310b92 bbf1e7e | | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com> | | Date: Tue Dec 11 22:06:49 2012 -0200 | | | | Merge branch 'master' of github.com:rodolfospalenza/ancestry | | | * commit bbf1e7e177f0a86f635c41b6181f1694a71492ce | | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com> | | Date: Tue Dec 11 21:52:47 2012 -0200 | | | | Add new file. | | * | commit 5310b92074cde08673a622a476ee95edd98cd387 |/ Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com> | Date: Tue Dec 11 22:02:54 2012 -0200 | | Add old file. | * commit 39f00abbbca1e6e90b1a268e918342b6950812c5 | Author: Stefan Henzen <s.f.henzen@nedforce.nl> | Date: Fri Jun 29 14:50:18 2012 +0200 | | fix readme, small fix in restore_ancestry_integrity!
  • 20. #10 REBASE VS. PULL   MERGE   COMMIT  USER  01   COMMIT  USER  02  
  • 21. #10 REBASE VS. PULL  
  • 22. #10 REBASE VS. PULL   USER 02   ~/ancestry [master] $ git fetch origin From github.com:rodolfospalenza/ancestry 39f00ab..bbf1e7e master -> origin/ master ~/ancestry [master] $ git rebase origin/master master First, rewinding head to replay your work on top of it... Applying: Add old file.
  • 23. #10 REBASE VS. PULL   USER 02   ~/ancestry [master] $ git log --graph * commit c765729377be06ecba78e3dd110a66f348699475 | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com> | Date: Tue Dec 11 22:16:26 2012 -0200 | | Add old file. | * commit bbf1e7e177f0a86f635c41b6181f1694a71492ce | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com> | Date: Tue Dec 11 21:52:47 2012 -0200 | | Add new file. | * commit 39f00abbbca1e6e90b1a268e918342b6950812c5 | Author: Stefan Henzen <s.f.henzen@nedforce.nl> | Date: Fri Jun 29 14:50:18 2012 +0200 | | fix readme, small fix in restore_ancestry_integrity!
  • 24. #10 REBASE VS. PULL   USER 02   ~/ancestry [master] $ git push origin master Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (2/2), 250 bytes, done. Total 2 (delta 1), reused 0 (delta 0) To git@github.com:rodolfospalenza/ancestry.git bbf1e7e..c765729 master -> master
  • 25. #11 AMENDED COMMIT   ~/ancestry [master] $ git log --graph * commit c765729377be06ecba78e3dd110a66f348699475 | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com> | Date: Tue Dec 11 22:16:26 2012 -0200 | | Add old file. | ~/ancestry [master] $ git add . ~/ancestry [master] $ git commit --amend
  • 26. #11 AMENDED COMMIT   1 Add old file. 2 3 # Please enter the commit message for your changes. Lines starting 4 # with '#' will be ignored, and an empty message aborts the commit. 5 # On branch master 6 # Changes to be committed: 7 # (use "git reset HEAD^1 <file>..." to unstage) 8 # 9 # new file: old_file 10 #
  • 27. #11 AMENDED COMMIT   ~/ancestry [master] $ git log --graph * commit e1dbf27ef62cef023437a710f5101dbf762efbef | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com> | Date: Tue Dec 11 22:16:26 2012 -0200 | | Add old file. |
  • 28. #12 INTERACTIVE REBASE   ~/ancestry [master] $ git log --graph * commit 3c8464613ce94ff78372ce5c0fbf049d2fa5524e | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com> | Date: Tue Dec 11 22:51:10 2012 -0200 | | Add example file. | * commit e1dbf27ef62cef023437a710f5101dbf762efbef | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com> | Date: Tue Dec 11 22:16:26 2012 -0200 | | Add old file. | ~/ancestry [master] $ git rebase –i HEAD~3
  • 29. #12 INTERACTIVE REBASE   1 pick bbf1e7e Add new file. 2 r e1dbf27 Add old file. 3 f 3c84646 Add example file. 4 5 # Rebase 39f00ab..3c84646 onto 39f00ab 6 # 7 # Commands: 8 # p, pick = use commit 9 # r, reword = use commit, but edit the commit message 10 # e, edit = use commit, but stop for amending 11 # s, squash = use commit, but meld into previous commit 12 # f, fixup = like "squash", but discard this commit's log message 13 # x, exec = run command (the rest of the line) using shell 14 # 15 # These lines can be re-ordered; they are executed from top to bottom. 16 # 17 # If you remove a line here THAT COMMIT WILL BE LOST. 18 # However, if you remove everything, the rebase will be aborted. 19 # 20 # Note that empty commits are commented out
  • 30. #12 INTERACTIVE REBASE   1 Add old file with rebase. 2 3 # Please enter the commit message for your changes. Lines starting 4 # with '#' will be ignored, and an empty message aborts the commit. 5 # Not currently on any branch. 6 # You are currently editing a commit during a rebase. 7 8 # Changes to be committed: 9 # (use "git reset HEAD^1 <file>..." to unstage) 10 # 11 # new file: old_file 12 #
  • 31. #12 INTERACTIVE REBASE   ~/ancestry [master] $ git rebase –i HEAD~3 [detached HEAD e2afa36] Add old file with rebase. 1 file changed, 3 insertions(+) create mode 100644 old_file [detached HEAD 952118d] Add old file with rebase. 2 files changed, 4 insertions(+) create mode 100644 example create mode 100644 old_file Successfully rebased and updated refs/heads/master.
  • 32. #12 INTERACTIVE REBASE   ~/ancestry [master] $ git log --graph * commit 952118d7fb53a33040f50707053ee1499f0728b9 | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com> | Date: Tue Dec 11 22:16:26 2012 -0200 | | Add old file with rebase. | * commit Tue Dec 11 21:52:47 2012 -0200 | Author: Rodolfo Spalenza <rodolfo.spalenza@gmail.com> | Date: Tue Dec 11 22:16:26 2012 -0200 | | Add new file. |
  • 33. REFERENCES   h<ps://help.github.com/arGcles/fork-­‐a-­‐repo   h<p://git-­‐scm.com/book/en/Git-­‐Branching-­‐Rebasing   h<p://learn.github.com/p/rebasing.html   h<p://blip.tv/akitaonrails/screencast-­‐come-­‐ando-­‐com-­‐ git-­‐6074964