DEV Community

Cover image for Cherry-Pick Your Teammate's Changes Without Push 'n Pull-ing To Your Repo In VS Code
Fred for GitLive

Posted on

Cherry-Pick Your Teammate's Changes Without Push 'n Pull-ing To Your Repo In VS Code

You asked your teammate for help with a piece of code and they showed you the solution in their editor. Now you need to fetch those changes. Usually, this would mean a series of tedious Git commands for both of you (not to mention that the changes will forever grace your git history), but no longer - GitLive allows you to cherry-pick your teammate's changes straight from their local files without having to push and pull to Git.

In VS Code, open up the team tab by clicking on the GitLive icon on the activity bar.

img-1.jpg

This will show a list of your teammates, if they are online (or away) and the issue they are currently working on. Click the arrow on the left-hand side of the teammate that helped you to see the repositories they have cloned, locate the one they made the changes to and click the arrow beside that too.

img-2-test (1).png

Here, you can see the list of files changed by your teammate on their branch compared to the main branch. Files with dots next to the name contain changes made locally by your teammate that have not yet been pushed to the remote repository.

Since we are only interested in their local changes, click the filter icon at the top of the team tab to filter to only the unpushed changes.

img-3-final-full.png

Now we can see the single file that contains the solution we want to copy! Clicking on it will open a diff of the changes so we can make sure it contains only the changes we need. Now all we need to do is click the cherry icon next to the file in the team tab to cherry-pick the changes. And voilà - no need for any git push- or git pull -ing!

You can also perform the cherry pick at the level above if you want to pick all changes from multiple files at once by clicking the cherry icon on the repository.

image-popup-5.png

Don't have the GitLive extension installed yet? You can find it here, and if you want to learn more, check out this blog post or the GitLive docs.

Discussion (3)

Collapse
darkwiiplayer profile image
DarkWiiPlayer

I honestly don't really get the problem here... What's wrong with the cherry-pick command?

Collapse
fredgl profile image
Fred Author

You're right I didn't make that very clear in the article - with GitLive you can cherry-pick directly from a teammate's local files without having to push and pull to Git. I've amended the intro to make this clearer, thanks for the heads up!

Collapse
steakeye profile image
Andrew Keats

Cherry picking has never been so easy!