0

I've a repository called communication_app a branch called teleApp and other repository is communication_app_patient of branch called patient_interface

I want to push the code of communication_app changes in to communication_app_patient

how to migrate these changes?

Mohan
  • 375
  • 1
  • 9
  • `git push https://github.com/the_other_repo communication_app:communication_app_patient` – iBug Feb 08 '21 at 09:08
  • 2
    Does this answer your question? [Push commits to another branch](https://stackoverflow.com/questions/13897717/push-commits-to-another-branch) – Omar Einea Feb 08 '21 at 09:18
  • i've two repo's , one of repo `communication_app` which i'm working and i want to push those changes to `communication_app_patient` repo – Mohan Feb 08 '21 at 09:22

1 Answers1

-1

First clone your initial repository to a new location (for example, ~/saveMe/initialRepo).

mkdir -p ~/saveMe/initialRepo
cd ~/saveMe/initialRepo
git clone <initial repository URL>
  1. Checkout to the new implementation branch by creating a new local branch. (for example, go-implementation) git checkout -b go-implementation origin/go-implementation

  2. Create the new repository on Git.

  3. Clone the new repository to a new location. (for example, ~/saveMe/newRepo)

mkdir -p ~/saveMe/newRepository`
cd ~/saveMe/newRepo
git clone <new repository URL>`
  1. Create a new remote inside the new repository (super-awesome-project) for the initial repository (awesome-project) git remote add initial-repo <path-to-cloned-initial-repository>

  2. Pull all the files and directories from initial repository (awesome-project) go-implementation branch to the master branch of the new repository (super-awesome-project) with preserving history. git pull initial-repo go-implementation --allow-unrelated-histories

  3. Remove the remote added for the initial repository (awesome-project) inside the new repository (super-awesome-project). git remote rm initial-repo

  4. Add all changes and push to git.

git add .
git push origin 

From the following article, https://kasunsiyambalapitiya.medium.com/move-git-branch-from-one-repository-to-another-with-preserving-history-81ed64de3a02

Shaqil Ismail
  • 1,794
  • 1
  • 4
  • 5