Skip to content

Latest commit

 

History

History
140 lines (86 loc) · 2.17 KB

02-Practice-Test-Branches.md

File metadata and controls

140 lines (86 loc) · 2.17 KB

Practice Test - Branches

Solutions to practice test - Branches

  • Refer the previous lecture, Branch is nothing but a pointer to a specific commit in GIT

    Pointer to a specific commit in git
    
  • By default the branch used is master

  • Simply run cd /home/sarah/story-blog; git log --name-only

    $ cd /home/sarah/story-blog
    $ git log --name-only
    
  • Check branch in the git log --decorate output

    $ git log --decorate
    
  • Run git checkout -b story/frogs-and-ox

    $ git checkout -b story/frogs-and-ox
    
  • Check branch HEAD pointer in git log output

    $ git log
    
  • Run git add frogs-and-ox.txt; git commit -am 'Add incomplete frogs-and-ox story'

    $ git add frogs-and-ox.txt
    $ git commit -am 'Add incomplete frogs-and-ox story'
    
  • Run git checkout master

$ git checkout master
  • Use vi editor to edit the file and fix the typo. Then run the command git commit -am 'Fix typo in story title'

    $ git commit -am 'Fix typo in story title'
    
  • Run the command git checkout story/frogs-and-ox

    $ git checkout story/frogs-and-ox
    
  • Run the command git commit -am 'Completed frogs-and-ox story'

    $ git commit -am 'Completed frogs-and-ox story'
    
  • Change to directory cd /home/sarah/website and run git branch command

    $ cd /home/sarah/website
    $ git branch
    
  • Checkout to directory git checkout feature/signout; git log --graph --decorate

    $ git checkout feature/signout
    $ git log --graph --decorate
    
  • Checkout to directory git checkout feature/signout; git log --graph --decorate

    $ git checkout feature/signout
    $ git log --graph --decorate