1

Dear helpful stackoverflow members,

I've been reading for awhile looking for an answer to this question and haven't been able to find anything on it specifically so I figured I'd ask for some input.

Here's the scenario:

I've been doing subcontract work for another contractor doing webdesign for a third party. After he gave me the job, in order to keep things separate (and so he could double check my work), he created cloned the original git to a remote git on a private server. Then, (obviously) I cloned this git to my local computer.

I did several (~5) commits under my own name and pushed them to the private server's remote git. Next, realizing that all the commits should be in his own name, the contractor ran some sort of program or command to change all of the commits I made to instead show his own name as author/commiter, and then pushed these commits onto the original remote third party git. [As a side note, I'm not exactly sure what he ran but I'm assuming it was some scripted version of the history-breaking filter-branch command discussed in a number of threads here {best one: Change the author and committer name and e-mail of multiple commits in Git} (a version of which is also on a git help page).]

At this point, the contractor notified me that he had done this and told me not to commit or push to our private server's remote git until I changed the setting in my local git to his user.name and user.email. Unfortunately, by the time I was informed, I had already done a good chunk of work on my local repository.

So here's my problem: From everything I've read, I think the only was to continue my work will be to delete my local repository and re-clone the version that is now on our private server (to avoid conflict with the previous commit SHA-1s). In other words, currently, I don't think there's anyway of me committing and then pushing/merging my changes onto the version of the private server's remote git since it has changed.

So, if I delete my local git, I lose a significant amount of work, but then I can 're-sync' with the 'new' version on the private server...BUT, this is obviously unacceptable as I certainly do not feel like doing another 20 hours of work just to get back to where I was. Is there anyway to pull down the new version but still preserve my changes?

NOTE: Other than changing the author/commiter he has not made any changes to any files. Also NOTE: All of the work I've done which stands to be lost has not yet been commited to my local git.

Any ideas? ...I could really use the help.

Thanks so much in advance, Best Regards, Tom

Community
  • 1
  • 1
Tom
  • 11
  • 1

1 Answers1

0

Just use git pull --rebase to replay your local changes on the top of modified history from the server.

kan
  • 28,279
  • 7
  • 71
  • 101
  • Thanks so much for the quick reply but from what I understand this won't be sufficient. As far as I can tell, I won't be able to pull down the changed version of the git onto my local repository because of the history break. I could very well be wrong, I'm really not sure, but I'm concerned about losing my changes. Could I perhaps use git stash to set aside all the changes I've made so far (since I haven't committed since all this happened) and then just do a normal git pull, and then pop the stash and commit as normal? – Tom Sep 07 '12 at 22:35
  • In git you could commit anytime you wish. You could commit and make backup of the `.git` folder to be completely sure you have a copy. – kan Sep 08 '12 at 15:41
  • Make a backup of your whole repository as it is, and you're on the safe side doing further experiments. – Michael Oct 02 '12 at 17:55