Developer A was previously push everything to my-repo, eventually developer B created a new repo and clone all commits from old repo.

Developer B doesn’t inform A, thus A continue to work on old repo.

Now, B request A to push the latest commit to the new repo

First of all, add the new repo URL to the project

1
2
$ cd /path/to/project
$ git remote add neworigin git@bitbucket.org:myname/my-new-repo.git

Then now A can push a specific commit to the new repo

1
2
3
4
5
6
7
8
$ git push neworigin 7300a6130d9447e18a931e898b64eefedea19544:master
Counting objects: 25, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (13/13), done.
Writing objects: 100% (13/13), 1.12 KiB | 0 bytes/s, done.
Total 13 (delta 7), reused 0 (delta 0)
To git@bitbucket.org:others/new-repo.git
2a94403..7300a61 7300a6130d9447e18a931e898b64eefedea19544 -> master
  • neworigin refer to the new URL added just now
  • 7300a6130d9447e18a931e898b64eefedea19544 is the commit hash
  • master is branch in remote (Bitbucket)

References: