-1

I have two repos. One is development which is private and one is official which is public.

I do all my work in development repo and all the commit history is in there. Now i want to merge development into official in one commit but i do not want all the history from development. Just actual code change merge in one single commit.

So far i am not able to find any way of merging repo A into repo B without the history from repo A. I tied http://blog.caplin.com/2013/09/18/merging-two-git-repositories/ but no luck and tried several more like Import a git repository with all its history into an existing git repository

Community
  • 1
  • 1
Zero Cool
  • 459
  • 1
  • 9
  • 23
  • *"Just actual code change merge in one single commit."* -- Use a visual comparison tool to compare the files from `A` and `B` working trees, copy the files that are only in `A` to `B`, merge the files that are in both repositories, solve any conflicts you may have, stage in `B` and commit. Try [BeyondCompare](http://scootersoftware.com); it is a very good visual comparison tool. – axiac Aug 05 '15 at 14:20

2 Answers2

1

This is a job for git merge --squash.

  1. Create a branch for commits you want to squash (if you haven’t made one yet), let’s call it dev.
  2. Set master (or any other branch) to the point you want to commit onto.

Then issue following commands:

git checkout master
git merge --squash dev
git commit

This will create a new commit in your local repo containing all the changes from the dev branch. Then you can push the commit to the remote repo.

Melebius
  • 6,183
  • 4
  • 39
  • 52
0
  1. Make sure the working copy of the development repo is up-to-date; that there are no uncommitted changes.

  2. Copy all the working files from the development repo to the public repo.

  3. Remove all files that are not in the working copy of the development repo from the working copy of the public repo.

  4. Commit the changes to the public repo.

Roland Smith
  • 42,427
  • 3
  • 64
  • 94