Kalle
Kalle

Reputation: 13346

Apply master repo changes into duplicate repository

I have a git mirror according to option 1 on https://help.github.com/articles/duplicating-a-repository/ and I want to apply the changes done on the actual master.

I identified the latest commit in my repo as commit 2f7... so I do:

master$ git format-patch 2f7... --stdout > fix

then copy fix into mirror and do

mirror$ git apply --check fix
error: patch failed: .travis.yml:1
error: .travis.yml: patch does not apply
error: include/univalue.h: No such file or directory
error: lib/univalue.cpp: No such file or directory

There are no changes in the mirror compared to the master.

How can I apply the commits after commit XXX in repo A into repo B?

Upvotes: 1

Views: 68

Answers (1)

MateuszL
MateuszL

Reputation: 2983

What You probably want to do is:

  1. add origin repo as remote (probably already is), lets say named "upstream"
  2. checkout to YOUR latest commit/branch
  3. $git rebase -i upstream/master
  4. resolve merge conflicts, may be lots of them; afterward $git rebase --continue and repeat until finished
  5. $git push origin --force

after this, it will look like Your commits are done after changes in upstream. Alternatively, You can use $git merge upstream/master - it causes less work for conflict resolution, but complicates history.

Upvotes: 2

Related Questions