So far we have covered the basics of git -- committing, branching, and moving around
in the source tree. Just these concepts are enough to leverage 90%
of the power of git repositories and cover the main needs of developers.
That remaining 10%, however, can be quite useful during complex workflows (or when you've gotten yourself into a bind).
The concept we are going to cover is "moving work around" -- in other words, it's a way for developers to say "I want this work here and that work there" in precise, eloquent, flexible ways.
This may seem like a lot, but it's a simple concept.
The first of the two commands we are going to see is called
git cherry-pick. It takes on the following form:
git cherry-pick Commit1 Commit2 ...
It's a very straightforward way of saying that you would like to copy a series of commits below your current location (HEAD). I personally love cherry-pick because there is very little magic involved and it's easy to understand.
Here's a repository where we have some work in branch side that we want to copy to master.
This could be accomplished through a rebase (which we have already learned), but what if we only want some specific commits and not others?
Let's say that we don't want the changes from C3.
git cherry-pick C2 C4
That's it! We wanted commits C2 and C4 and git plopped them down right below us. Simple as that!
To complete this level, simply copy some work from the three branches shown into master. You can see which commits we want by looking at the goal visualization.