7

I've moved a repo from computer A to computer B. I've verified that the commits waiting to be pushed are still there on B, but the whole repo (every single file) is unstaged. I don't want to add them and push them as a commit because I have not changed every single file from when I copied the repo till I pasted it. When I moved the repo it only had the commits pending to be pushed, not changes.

I have seen this question, but it didn't help with this.

halfer
  • 19,824
  • 17
  • 99
  • 186
Odaym
  • 1,896
  • 1
  • 20
  • 31
  • How did you move it? – Holloway Sep 24 '14 at 16:07
  • 1
    copied the whole folder to a USB stick and pasted it at B. At B, imported the project from Eclipse (copy projects into working space). Delete the imported one (the one that was first copied) and using the copy Eclipse would have created in "workspace" folder – Odaym Sep 24 '14 at 16:09

1 Answers1

9

On the copied repo folder of computer B, do

git reset --hard HEAD

if you just want to copy the committed code from A to B but leave behind the local modification on B, after copy the repo folder from A to B.

palazzo train
  • 3,229
  • 1
  • 19
  • 40
  • nice and simple solution. here are docs regarding `git reset` https://git-scm.com/docs/git-reset – lasec0203 Mar 06 '18 at 01:04
  • **BE CAREFOUL**. This solution deletes all the *changes not staged for commit*. So, if you have files not commited, do this before copying the project. – cespon Apr 28 '22 at 21:34