DEV Community

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

Posted on

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

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 IntelliJ, open up the team window by clicking on the GitLive icon on the bottom tool window bar.

IJ-ultimate_2-box.png

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-1-full (1).png

Here, you can see the list of files changed by your teammate on their branch compared to the main branch. Files with asterisks next to the file icon 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 bottom of the team window to filter to only the unpushed changes.

img-2-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 to right click on the file and select the cherry-pick option to pick the changes. And voilà - no need for any git push- or git pull -ing!

img-3-full.png

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

img-4-full.png

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

Discussion (0)