You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is more common to cherry-pick select changes from feature branches
into master than it is to do the other way around.
Raymond Chen of "The Old New Thing" disagrees that there is any good use
for cherry-pick and provides an alternate solution; his solution is
given in the notes.
\goal{Cherry-pick \grefspec{D} into the current branch.}
357
-
\defaultrepo
358
-
\end{frame}
356
+
The \gbranch{master} branch is currently checked out.
357
+
Commit \grefspec{E} contains a useful change that you want to integrate right away.
359
358
360
-
\begin{frame}
361
-
\frametitle{\gitcmd{cherry-pick D}}
362
-
\framesubtitle{Create a new commit from the changes in \grefspec{D}.}
359
+
\goal{Cherry-pick \grefspec{E} into the current branch.}
363
360
\begin{figure}
364
361
\centering
365
362
\begin{tikzpicture}
366
363
\gitDAG{
367
364
A -- B -- {
368
365
D,
369
-
C -- E -- D$'$
366
+
C -- E
370
367
}
371
368
};
372
369
\gitbranch{master}
373
370
{above=of D} {D}
374
371
\gitbranch{topic}
375
-
{above=of D$'$} {D$'$}
372
+
{right=of E} {E}
376
373
\gitHEAD
377
-
{above=of topic} {topic}
374
+
{left=of master} {master}
378
375
\end{tikzpicture}
379
376
\end{figure}
380
-
A new commit, \grefspec{D$'$}, that contains the same changes as \grefspec{D} was added on top of \grefspec{E}. \gHEAD{} and \gbranch{topic} were advanced to \grefspec{D$'$}.
377
+
\end{frame}
378
+
379
+
\begin{frame}
380
+
\frametitle{\gitcmd{cherry-pick E}}
381
+
\framesubtitle{Create a new commit from the changes in \grefspec{E}.}
382
+
\begin{figure}
383
+
\centering
384
+
\begin{tikzpicture}
385
+
\gitDAG{
386
+
A -- B -- {
387
+
D -- E$'$,
388
+
C -- E
389
+
}
390
+
};
391
+
\gitbranch{master}
392
+
{above=of E$'$} {E$'$}
393
+
\gitbranch{topic}
394
+
{right=of E} {E}
395
+
\gitHEAD
396
+
{left=of master} {master}
397
+
\end{tikzpicture}
398
+
\end{figure}
399
+
A new commit, \grefspec{E$'$}, that contains the same changes as \grefspec{E} was added on top of \grefspec{D}. \gHEAD{} and \gbranch{master} were advanced to \grefspec{E$'$}.
381
400
382
401
\note{
383
-
This is a bad example because it would be better to do a \gitsubcmd{rebase} or a \gitsubcmd{merge} in this case,
384
-
but it is one of the simplest examples.
402
+
Cherry-picking may result in merge conflicts later on.
403
+
Raymond Chen suggests using a merge-based strategy instead:
0 commit comments