medev21 medev21 - 1 year ago 61
Git Question

moving a git folder from local computer to an existing repo - commit history included

I'm trying to move a folder (let's call it "projectA") I've started with git version control in local computer- it has not repo connected

I would like to move "projectA" along with its history commit to a new repo called projectB.

projectA - this is stored in local computer and has no github repo

projectA - 'final destination'

So far I understand I have to do
git clone
for projectB, but after that I don't know to transfer projectA with its history commit under ProjectB.

Can anybody help me with this? I only know the basics of git - add commit pull push. Your help will be appreciated.

Answer Source

In your Project A create a new branch

git checkout -b project_a_work

Add remote github repo for Project B

git remote add origin

Do a git fetch and checkout project B master(any other branch you want to merge on)

git fetch
git checkout origin/master

Now merge the Project A work on Project B's current checkout branch

git merge project_a_work


If you want all Project A history to be written after last commit on Project B, you can do git rebase

git rebase project_a_work
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download