Skip to content

Commit ba0de4b

Browse files
committed
Add alt text to images
1 parent a6c2f4b commit ba0de4b

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

posts/git-cherry-pick/index.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,57 +36,57 @@ When using cherry pick it is very important to look at your git log and understa
3636

3737
First it can be useful to look at the branches you have. I did this with the `git branch` command and as you can see the one with the asterik and in green is the branch I am currently on.
3838

39-
![](show-branches.png)
39+
![image showing branches with asterik showing the branch user is on](show-branches.png)
4040

4141
I use `git lola` which is an alias: `lola = log --graph --decorate --oneline --all`. I highly recommending adding this alias to your `.gitconfig`.
4242

43-
![](lola-1.png)
43+
![git history with circle around the commit that will be cherry-picked](lola-1.png)
4444

4545

4646
Here you can see that I have the `cherry-pick-post` branch checked out, as indicated by the `HEAD` ref. I have made changes to the about section which I actually wanted to do on the main branch. So I will use `git cherry-pick` to make that happen. First you want to be sure you are on the branch that you want to put the commit on.
4747

48-
![](status-on-cpp-branch.png)
48+
![image showing results of 'git status' command. Shows current branch and that there is nothing to commit.](status-on-cpp-branch.png)
4949

5050
I can see I am on the `cherry-pick-post` branch but I want the new commits to be created on `main`, so I will use `git switch` to go to the `main` branch.
5151

52-
![](switch-main.png)
52+
![git switch command shown moving the head to main branch](switch-main.png)
5353

5454
Now I am on the desired branch so I can go ahead and cherry-pick using the syntax `git cherry-pick <commit>`.
5555

56-
![](pick-commit-1.png)
56+
![pick command with previously circled commit #4ea71f7 chosen and git response shown](pick-commit-1.png)
5757

5858
To see what this did we will once again do `git lola`:
5959

60-
![](lola-after-pick1.png)
60+
![git log command run showing new comnit with same caption as 4ea71f7 (update about page) on main branch](lola-after-pick1.png)
6161

6262
Now the `Update about page` commit is on both the `cherry-pick-post` branch and the `main` branch. Note that the commit ID on the `main` branch is a new ID, but the original commit on `cherry-pick-post` branch has the same ID as before.
6363

6464
We will now push and look at the log again.
6565

66-
![](push-and-lola.png)
66+
![git push command shown at top of image followed by git lola command with 'Update about page' commit shown on origin.main, Head, main branch](push-and-lola.png)
6767

6868
At this point `main` appears exactly as we want it to, but `chery-pick-post` still has the unwanted commit.
6969

7070
So at this point we will once again use the cherry-pick command to move forward. I will create a new branch called `cherry-pick-1` from the main branch.
7171

72-
![](new-branch.png)
72+
![creation of new cherry-pick-1 branch using git switch -c command](new-branch.png)
7373

7474
Now at this point I want to take everything from the old `cherry-pick-post` branch and pick it to my new branch.
7575

7676
There are 3 commits that I want so I can actually pick them all a once.
7777

7878
`git cherry-pick 9e5da76 463956b 3edb3ee`
7979

80-
![](pick-2.png)
80+
![git response to the cherry pick command listed above this image](pick-2.png)
8181

8282
Git gives a great summary of what is happening and shows the commits I am picking.
8383
To see where I am at I will do `git lola` once again.
8484

85-
![](lola-2.png)
85+
![git log showing head on new branch containing the 3 picked comits with new commit numbers](lola-2.png)
8686

8787
At this point I have the 3 commits I want on my new branch so I can go ahead and push that branch. `git push -u origin cherry-pick-1`
8888

89-
![](lola-3.png)
89+
![log after push](lola-3.png)
9090

9191
Now I no loger want the old branch so I will delete it using `git branch -D cherry-pick-post` this will only delete it locally, so I will also need to do `git push origin :cherry-pick-post` to delete the branch from GitHub.
9292

0 commit comments

Comments
 (0)