2

I downloaded a big zip file from Github, months ago. I decided to change some parts of the project. I unzipped the file contents and made a mistake and executed these lines:

git init
git add .
git commit -a

git fetch https://github.com/Path_To_Project

This last line downloaded a big amount of data, which I thought it would auto merge it with my local files.

Now, I see that my local project is not updated. Still there are a huge amount of data in .git/objects folder. How can I merge those data into my project?

Mostafa Shahverdy
  • 2,687
  • 2
  • 30
  • 51

1 Answers1

1

This last line downloaded a big amount of data, which I thought it would auto merge it with my local files.

It would merge if you do a:

git pull https://github.com/Path_To_Project

Or, since you already fetched:

git merge origin/master
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I tried `git merge origin/master`, but as I directly executed `git init` and don't have a remote set up, it says: `fatal: origin/master - not something we can merge` – Mostafa Shahverdy Feb 16 '14 at 15:30
  • @MostafaShahverdy then reverse it. Clone the repo, Create a new branch in which you copy over your modification, and merge that branch into master. The trick is to create that branch not from master, but from an older SHA1 at the time of your older zip (so from a few month ago). Creating a new branch from master and merging it would simply report all new modifications on top of master instead of merging it. – VonC Feb 16 '14 at 15:37
  • Will you please tell me how to see those "modifications" I've downloaded? I only know that somethings is in `.git/objects` folder. – Mostafa Shahverdy Feb 16 '14 at 16:14
  • @MostafaShahverdy simply clone that repo elsewhere, and you will see those modifications. – VonC Feb 16 '14 at 16:16
  • I did, but only old repo cloned. without modifications, without "objects". – Mostafa Shahverdy Feb 16 '14 at 16:22
  • @MostafaShahverdy if you are talking about the modifications you did *locally*, you didn't downloaded them. – VonC Feb 16 '14 at 16:24
  • No, modifications from Github, which I wanted to download, to update my old repo. – Mostafa Shahverdy Feb 16 '14 at 16:25
  • @MostafaShahverdy As I said, clone the repo, you will see those. Then, if you want both sets of modifications merged together, you need to merge two different repos: http://stackoverflow.com/q/1425892/6309 – VonC Feb 16 '14 at 16:27