Skip to content

Latest commit

 

History

History
90 lines (56 loc) · 2.21 KB

cherry-pick-between-repo.mdx

File metadata and controls

90 lines (56 loc) · 2.21 KB

Take Commits Between Repositories

Source

Copy the commit hash

Source Image Hash

For example, I want to take this commit: eccde65

Replica

I’ll use term replica for other repositories that might use the same starter/components.

  1. Add the source remote to the replica repository

    git remote add source https://github.com/theodorusclarence/aether-design-system.git
    #              ^you can name it whatever you like
  2. Fetch remote

    git fetch source
    #         ^or your remote name
    
    git fetch --all
    # ^if you're feeling lazy (fetch all available repo)
  3. Cherry pick

    git cherry-pick eccde65

    If you have multiple commits to pick from, for example these 3:

    multiple commit images

    put the oldest commit first, the order matters

    ex: git cherry-pick 8cfc164 dee8c34 eccde65

  4. Done

    cherry pick applied

    it works even if you have other commits that are different from the source

Common Case: Conflict

It’s quite common, don’t panic

For example, you have a commit in the replica that changed PaginatedTable

replica changes

And you also have a different change on the source’s commit eccde65

source's commit

It will create a conflict like this

conflict in terminal

conflict in vscode

Solve them, add to staging, then continue the cherrypick

git cherry-pick --continue

Demo Video

Here's a demo

<iframe style={{ aspectRatio: '16/9', }} width="100%" src="https://www.youtube.com/embed/585eNahJYeQ" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowFullScreen />