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 CheatsheetAbdul Basit
 
Git flow for daily use
Git flow for daily useGit flow for daily use
Git flow for daily useMediacurrent
 
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 exampleGaurav Kumar Garg
 
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 easierChristoph Matthies
 
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 messesKatie Sylor-Miller
 
The Fundamentals of Git
The Fundamentals of GitThe Fundamentals of Git
The Fundamentals of GitDivineOmega
 
Git: basic to advanced
Git: basic to advancedGit: basic to advanced
Git: basic to advancedYodalee
 
From svn to git
From svn to gitFrom svn to git
From svn to gitNehal Shah
 
Honestly Git Playground 20190221
Honestly Git Playground 20190221Honestly Git Playground 20190221
Honestly Git Playground 20190221Shinho Kang
 
Git Basics at Rails Underground
Git Basics at Rails UndergroundGit Basics at Rails Underground
Git Basics at Rails UndergroundAriejan de Vroom
 
Checkitmobile Git Workshop
Checkitmobile Git WorkshopCheckitmobile Git Workshop
Checkitmobile Git WorkshopGerrit Wanderer
 
Checkitmobile - using Git for development
Checkitmobile - using Git for developmentCheckitmobile - using Git for development
Checkitmobile - using Git for developmentGerrit Wanderer
 
Checkitmobile advanced git
Checkitmobile advanced gitCheckitmobile advanced git
Checkitmobile advanced gitGerrit 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.artayahonestArtaya 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-artayahonestArtaya 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.artayahonestArtaya Honest
 
Simply me! --edu1103
Simply me!  --edu1103Simply me!  --edu1103
Simply me! --edu1103BrieHoover
 
Grammar book
Grammar bookGrammar book
Grammar bookannpear
 
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 homestephanieherzog72
 
Pengertian algoritma lengkap by.artayahonest
Pengertian algoritma lengkap by.artayahonestPengertian algoritma lengkap by.artayahonest
Pengertian algoritma lengkap by.artayahonestArtaya Honest
 
Vuit criteris claus d'intervenció educativa
Vuit criteris claus d'intervenció educativaVuit criteris claus d'intervenció educativa
Vuit criteris claus d'intervenció educativaCulturaPractica
 
Glacier National Park Vacation
Glacier National Park VacationGlacier National Park Vacation
Glacier National Park Vacationlnystrom
 
Lease clinic space
Lease clinic spaceLease clinic space
Lease clinic spaceAlysha Nieol
 
Grammar book 2
Grammar book 2Grammar book 2
Grammar book 2annpear
 
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)Andrew Wong
 
Edu ppt
Edu pptEdu ppt
Edu pptashzx3
 

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

Introducción a git y GitHub
Introducción a git y GitHubIntroducción a git y GitHub
Introducción a git y GitHubLucas Videla
 
Gitosis on Mac OS X Server
Gitosis on Mac OS X ServerGitosis on Mac OS X Server
Gitosis on Mac OS X ServerYasuhiro Asaka
 
Git Concepts, Commands and Connectivity
Git Concepts, Commands and ConnectivityGit Concepts, Commands and Connectivity
Git Concepts, Commands and ConnectivityRaja Soundaramourty
 
Git for beginners
Git for beginnersGit for beginners
Git for beginnersVinh Nguyen
 
GIT rozproszony system kontroli wersji
GIT rozproszony system kontroli wersjiGIT rozproszony system kontroli wersji
GIT rozproszony system kontroli wersji3camp
 
Version Control with Git for Beginners
Version Control with Git for BeginnersVersion Control with Git for Beginners
Version Control with Git for Beginnersbryanbibat
 
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 SystemTommaso Visconti
 
Git Basics (Professionals)
 Git Basics (Professionals) Git Basics (Professionals)
Git Basics (Professionals)bryanbibat
 
Get going with_git_ppt
Get going with_git_pptGet going with_git_ppt
Get going with_git_pptMiraz Al-Mamun
 
Sacándole jugo a git
Sacándole jugo a gitSacándole jugo a git
Sacándole jugo a gitBerny Cantos
 
Get Good With Git
Get Good With GitGet Good With Git
Get Good With GitHoffman Lab
 
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 2017Codemotion
 

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

Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 

Recently uploaded (20)

Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 

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