w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Force older commits to merge as if they were newer commits

The main command to use here would be git cherry-pick.

It allows you to cherry-pick one (or several) commit(s), and apply them on your current branch.

The commit date will change.

If you have both branches in the same repo, you can use that command directly.

If not, you can:

  • add the repo where you have the more recent commit as a remote:

    git remote add newcommits /url/to/repo/with/more/recent/commits
  • cherry-pick from that remote repo

    git fetch newcommits 
    git cherry-pick <new commits SHA1>
    git cherry-pick <new commits SHA1>

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.