-1

I have a git repository on remote server called test, with files hello.py and test.py.

And I have a local folder called workspace with file named goodbye.py. Can I make the local folder workspace to be the repository(test) directly?

I mean under workspace, there are hello.py and test.py and goodbye.py.

I want to ask this because if there are 3 members, they write code separately in their folders, and now we have to use git to control, so how to make the local folder to clone git repository directly?

ElGavilan
  • 6,214
  • 16
  • 25
  • 35
user2492364
  • 6,047
  • 18
  • 74
  • 137
  • Check this answer to see if it solves your problem: http://stackoverflow.com/questions/1425892/how-do-you-merge-two-git-repositories – fijas Apr 14 '15 at 13:06

3 Answers3

1

You can clone the repository with git clone to an empty directory, and then add your local files manually.

Vadim Landa
  • 2,644
  • 5
  • 23
  • 31
1

From your workspace folder, you can do the following:

  1. git init
  2. git add goodbye.py
  3. git commit -m "Initial commit on my local machine"
  4. git remote add origin <path-to-remote-git-repository>
  5. git pull origin master

This last one will fetch the data from the remote location and merge the remote masterbranch (i.e. origin/master) with your local master branch. I recommend you to search in the documentation for any of these commands if you are not sure of what they do before trying anything.

Яois
  • 3,718
  • 3
  • 25
  • 47
-1

You can use a tool like SmartGit, which gives you an interface to work with. Or you can do it with the terminal (which I recommand). Check out that quick tutorial! Getting an existing git repository

Raphaël Parent
  • 253
  • 3
  • 10