Skip to the main content

Take Commits Between Repositories

––– views

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/mattummal/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