Git Cherry-Picking with VS Code -Part 2

Published by on

Hi Geeks!

This is the second part of GIt Cherry-picking with VS code, In this blog, we will discuss How to do Cherry picking with VS code using some UI interface, If you don’t know about cherry-picking and how it works then please read our first blog Part 1.

Let’s begin with, I created a git project. Also created two branches one is master and another one is a feature. In master branch has 3 commits(Commit A, B, and C), in the feature branch has another three commits (Commits D, E, and F).

As I said in my part 1 blog, we can do this using the command line, and another way we can do this in VS code UI with help of some extension.

Step 1: Open your Git-based project in VS code and Install the GIT graph extension form vs code marketplace, Git Graph – Visual Studio Marketplace. After the successful installation, Open the Git Graph window by clicks on the Git Graph menu button in the footer section of VS code

The folder and git branching structure look like

Step 2: I am going to cherry-pick commit E from feature branch to master branch, so check out your master branch. Select commit that you want to do cherry-pick, Then right-click and select cherry Pick option

Step 3 you will get a cherry-pick confirmation popup window. If you want to cherry-pick without no commit then you can select the No commit option from that dialog box and click on the Yes Cherry-pick button.

If there are any conflicts occurred then you will get an Error window like given below. please resolve all conflicts and commit your code.

That’s it! , You have successfully completed git cherry-picking. After cherry-pick, your master branch structure look like

Happy coding!