A typical workflow with Git branching

A distributed version control system such as Git is designed for the complex and nonlinear workflows that are typical in interactive computing and exploratory research. A central concept is branching, which we will discuss in this recipe.

Getting ready

You need to work in a local Git repository for this recipe (see the previous recipe, Learning the basics of the distributed version control system Git).

How to do it...

  1. We go to the myproject repository and we create a new branch named newidea:
    $ pwd
    /home/cyrille/git/cookbook-2nd/chapter02
    $ cd myproject
    $ git branch newidea
    $ git branch
    * master
      newidea
    

    As indicated by the star *, we are still on the master branch.

  2. We switch to the newly-created newidea branch: ...

Get IPython Interactive Computing and Visualization Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.