Git Product home page Git Product logo

git-rebase-squash-exercise's Introduction

Git rebase and commit squashing exercise

Objective

In this exercise we will practice how to squash incomplete commits into one nice commit and replay it on top of the master branch.

Motivation

This technique is useful in situations where you need to make changes to a pull request before it can be integrated.

Exercise

Start the exercise by forking and cloning the repository.

The haiku branch represents a feature branch that is to be rebased (moved) and squashed.

On the haiku branch you find a script that prints a haiku:

$ python main.py

This is our haiku:

On a branch ...
                  by Kobayashi Issa

              On a branch
              floating downriver
              a cricket, singing.

The haiku is great but the commit history on the haiku branch is not (on purpose):

$ git log --oneline

65870f9 fix a copy-paste error
47a007d completed the haiku
a3278e3 another incomplete commit
54fba21 startign to work on it (commit with a typo)
3ff39a1 forgot to add a file
7e1f903 starting working on the haiku
c50a463 initial commit

Your task is to rebase the haiku branch on top of master and squash the several small "incomplete" commits into one single self-contained cherry-pickable commit.

In other words instead of this history:

alt text

we wish to arrive at this history:

alt text

by first rebasing the commits:

alt text

and later squashing them.

Verify the history and also that the script still works after the operation.

git-rebase-squash-exercise's People

Contributors

bast avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.