Can I merge 2 similar, but non tracked repositories in Git?

I have a mainline repository which I want to merge my new features into. These features were developed on a copy of this repo. The way this repo was created was by simply doing a git init and dropping a copy of everything in there (ie: no history from the mainline is there, the first commit is just a straight copy of everything). I know that I can bring the feature repo into the mainline repo as a new branch BUT… I seem to just get both added conflicts for any files that have changes in both. Also, I am not sure if my history will be brought over from the feature repository, into the mainline repository? Will it just be seen as a single, large commit? Is there a way to do this the kosher way despite my previous mistake?

  • How can I move large binaries from main to a git submodule?
  • Change the original branch for a feature branch
  • Git branching for agile development
  • Merge conflicts updating from upstream
  • Using different source control providers with different instances of Visual Studio
  • Git - don't merge deletes
  • How to merge two git repositories containing Xcode projects
  • How to reuse docker-compose projects?
  • Git reference conflicts between branches (unable to update local branch)
  • Git clone via HTTPS not working in Docker makefile
  • IntelliJ IDEA VCS rules to fail commit
  • Atom editor locking git
  • One Solution collect form web for “Can I merge 2 similar, but non tracked repositories in Git?”

    It sounds like you have made commits on the “mainline” repo since you started working on the “new features” repo. If this be the case, you will need to create a branch in the mainline repo from the commit that started the new repo, not the current commit.

    ---o---o---o  mainline
         o---o---o  new features

    something like

    cd mainline
    git checkout -b new-features <origin commit for new features>
    git remote add new-features ../new-features

    From there should you be able to git rebase / git merge / git cherry-pick to your liking. Also going forward, dont do what you did. If you want to “branch” then use git branch.

    Git Baby is a git and github fan, let's start git clone.