Simon Bliudze
Simon Bliudze

Reputation: 23

How can I "pull" a git database without downloading the whole repository

I have the content of a huge project (with some changes) but not the Git database. One could get to the same situation for example like this:

  1. git clone <...>/repo.git
  2. cd repo
  3. echo "Blah" > new_file.txt
  4. rm .git

Since my repo is huge and all the project files are still there, I do not want to re-clone everything. How can I get back to a normal situation, where I would be able to commit and push my new_file.txt?

I tried searching in general and among other questions here but nothing seems to provide the answer for this specific situation.

Upvotes: 2

Views: 1063

Answers (2)

fmontesi
fmontesi

Reputation: 181

  1. Clone the repository using git clone --no-checkout into another directory, say dir.
  2. Copy dir/.git to your repo.
  3. Go to your repo and run git reset.

Upvotes: 2

Lajos Arpad
Lajos Arpad

Reputation: 77073

There is a .git folder which contains the database. You could compress that into a zip file, download it and copy it into your folder. So, the steps:

  1. Navigate to the folder in the repository
  2. Compress the .git folder
  3. Download it
  4. Uncompress it into your folder

Upvotes: 0

Related Questions