1

I feel like there's a simple answer to this but I'm fairly new to git so looking at the documentation and other Stack overflow posts has been confusing me.

Let's say I have a local directory on my computer named home. Inside home are 2 files called "project1" and "configurations." I also have a remote git repo that exists on GitHub solely (I have not cloned it into any local directory) named myRepo.

I am trying to make it so home becomes a local clone of myRepo on my machine. When I try to git clone into the repo it just creates a new local repo inside of home called myRepo. I am aware the name difference may be a problem but I don't know the best way to approach this.

I would also like to preserve the previously existing local files "project1" and "configurations" in the newly cloned repo, instead of overwriting them. I'm aware I will need to eventually push them to the remote.

Can anyone give me advice on how to best go about this? And if you could explain it more in basic/layman terms I'd really appreciate it! I'm just very confused right now.

user313
  • 681
  • 1
  • 8
  • 21
  • So, you just want to add the github repository as a remote to the local repository? – Felix Kling Sep 08 '17 at 21:34
  • I believe so... I'm hoping to make it so the existing local directory "becomes" a local copy of the remote repo, while preserving all the local files there previously, if that's the same thing – user313 Sep 08 '17 at 21:36
  • 1
    You could put the local files in a new branch, add the github repo as a remote, check its master out as new master (not sure how easy it is to do that or how to do that) and then rebase or merge your local branch onto the new master. – Felix Kling Sep 08 '17 at 21:38

0 Answers0