1

I had repository with URL A - then i stopped working with it, and went to repository with URL B

Now i want to merge the changes from repository in URL B with the repository in URL A- in the process i need to wipe out everything that may have been in URL A, such that any files that were deleted in the process of making the project in URL B , will not be reincarnated...

How can I do that?

I am working with git and bitbucket

Lena Bru
  • 12,299
  • 9
  • 53
  • 109
  • 1
    What does `i need to wipe out everything that may have been in URL A` actually mean? As an aside using A and B as in the question makes it hard to read, when compared to giving none-abstract names and/or showing the commands you've **tried** to use and their output. It's a lot easier to understand a question of the form `I did , I got , but I want - how can I achieve ?`. – AD7six Jun 15 '14 at 15:04
  • I agree to AD7six. My question: maybe what you want to do is not directly related to Bitbucket: how have you cloned your respository (command line interface, CLI)? You may want to show the CLI command (at least from your memory) that you used. Further: it sounds you'd like to either merge two working trees (not the history I guess) or maybe just rename the project? Try to use other periphrases as well. :) – try-catch-finally Jun 15 '14 at 15:24

1 Answers1

0

if RepoB was done from RepoA history (as a true fork: starting from RepoA, and changing everything in it), then importing RepoB history in RepoA coud be done (assuming the main history to merge is on the master branch) using "ours" git merge merge strategy:

cd /path/toRepoA  # local clone
git remote add repoB /url/to/repoB
git fetch repoB
git checkout -b masterRepoB repoB/master
git merge -s ours master

That merge will make git consider master as merged to repoB/master... while keeping only repoB/master content (no files from repoA/master is in the result of that merge).

See also "Why would one use “git merge -s ours”?".

Then:

git checkout master
git merge masterRepoB

That will fast-forward HEAD from master to masterRepoB, making that master branch identical to repoB/master (masterRepoB)

You can then push master to /url/repoA: its content will be the one from repoB.

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283