Streamlining Cherry-Picking with TortoiseGit: A Simple Guide

Thanks to Vihanga Bandara for introducing this tool to mePhoto by Roman Synkevych on UnsplashIn this article, I’ll share my learning experience with a simple tool I’ve been using for the cherry-picking process at work.For each repository, we have two m…


This content originally appeared on Level Up Coding - Medium and was authored by Thanoshan MV

Thanks to Vihanga Bandara for introducing this tool to me

Photo by Roman Synkevych on Unsplash

In this article, I’ll share my learning experience with a simple tool I’ve been using for the cherry-picking process at work.

For each repository, we have two main branches—develop and master. Branch “develop” is for QA release, and branch “master” is for staging release. So, when we’re developing a feature, we’ll create multiple PRs for that feature and merge them into the “develop” branch.

In my first staging release experience, the feature I worked on had only one commit in the “develop” branch. I used Git Bash to create a fresh branch from “master” and cherry-picked that one commit using the command — git cherry-pick. There were some merge conflicts. I resolved them using Visual Studio Code’s merge-conflict editor tool. It was easy!

Later, I had to do the staging release for a set of independent features. For a particular repository, it had around 6 commits in the “develop” branch. As always, I listed down the commit SHA in the order. I began the cherry-picking process by executing the commands one by one and resolving some merge conflicts here and there. It was really difficult.

I noted some issues with this process:

  1. Time-consuming
  2. Error-prone: what if we execute the commit SHA not in the order? What if we resolve the merge conflict carelessly due to this tiring and time-consuming process?

Then, I had to do the staging release with my lead for a set of features of mine and his. For a particular repository, it contained around 14 commits in the “develop” branch. I was already hesitant about the one-by-one cherry-picking process but he introduced me to this simple tool for the cherry-picking process — TortoiseGit.

We can easily do the cherry-picking using this tool. We’ll check out how we can do that.

  1. Create the branch where you want to cherry-pick. In my case, I would create a new branch from the “master” branch.
  2. Go to the repository file and open TortoiseGit’s show log

3. Click your branch in the Log Messages panel

4. Select the remote branch where you want to cherry-pick the commits from. In my case, it would be the “develop” branch.

5. Select all the commits that you want to cherry-pick. Then right-click on any of the selected commits and select “Cherry Pick selected commits…”

6. Click on “Continue” to start the cherry-picking process. Notice that the tool automatically orders the commits by when they got merged into the “develop” branch. We don’t have to do anything here. We have to select the commits.

That’s it. The tool will cherry-pick each commits one by one. If a merge conflict occurs, the tool will open a new merge conflict window. We can use that to easily resolve the conflict and continue the cherry-picking process.

It’s an easy, less time-consuming and less error-prone approach than cherry-picking by manually executing the Git command.

Apart from cherry-picking, this tool supports all Git operations. It’s free and open-source. Please check it out — TortoiseGit.

I hope my learning experience has provided some value to you.


Streamlining Cherry-Picking with TortoiseGit: A Simple Guide was originally published in Level Up Coding on Medium, where people are continuing the conversation by highlighting and responding to this story.


This content originally appeared on Level Up Coding - Medium and was authored by Thanoshan MV


Print Share Comment Cite Upload Translate Updates
APA

Thanoshan MV | Sciencx (2024-10-21T21:29:41+00:00) Streamlining Cherry-Picking with TortoiseGit: A Simple Guide. Retrieved from https://www.scien.cx/2024/10/21/streamlining-cherry-picking-with-tortoisegit-a-simple-guide/

MLA
" » Streamlining Cherry-Picking with TortoiseGit: A Simple Guide." Thanoshan MV | Sciencx - Monday October 21, 2024, https://www.scien.cx/2024/10/21/streamlining-cherry-picking-with-tortoisegit-a-simple-guide/
HARVARD
Thanoshan MV | Sciencx Monday October 21, 2024 » Streamlining Cherry-Picking with TortoiseGit: A Simple Guide., viewed ,<https://www.scien.cx/2024/10/21/streamlining-cherry-picking-with-tortoisegit-a-simple-guide/>
VANCOUVER
Thanoshan MV | Sciencx - » Streamlining Cherry-Picking with TortoiseGit: A Simple Guide. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/10/21/streamlining-cherry-picking-with-tortoisegit-a-simple-guide/
CHICAGO
" » Streamlining Cherry-Picking with TortoiseGit: A Simple Guide." Thanoshan MV | Sciencx - Accessed . https://www.scien.cx/2024/10/21/streamlining-cherry-picking-with-tortoisegit-a-simple-guide/
IEEE
" » Streamlining Cherry-Picking with TortoiseGit: A Simple Guide." Thanoshan MV | Sciencx [Online]. Available: https://www.scien.cx/2024/10/21/streamlining-cherry-picking-with-tortoisegit-a-simple-guide/. [Accessed: ]
rf:citation
» Streamlining Cherry-Picking with TortoiseGit: A Simple Guide | Thanoshan MV | Sciencx | https://www.scien.cx/2024/10/21/streamlining-cherry-picking-with-tortoisegit-a-simple-guide/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.