0

After executing the command git reset --hard commitid and git push --force, and pushing some commits on the repo(Staging), the new commits does not reflect on the server.

My colleagues were able to see my commits but the changes does not reflect on the site and when checking on the file on the server, the file is not updated.

The HEAD looks correct based on what I can see from the SourceTree and Terminal.

Already tried reseting the HEAD to the new commit just to make sure but still having the same problem.

Also tried git push origin Staging and git push origin Staging:Staging and still having the same problem.

EDIT

Tried also git log on the server and noticed that the commits are different from my local. Some of the latest commits from the server should be removed because of the reset that I made but only my local git has been updated.

royki
  • 1,593
  • 3
  • 25
  • 45
putoshop
  • 112
  • 3
  • 13
  • "when checking on the file on the server"? Describe the file you are talking about. – trojanfoe Jul 23 '15 at 12:45
  • @trojanfoe, it's a javascript file that I have edited for testing because other updates were not reflecting on the server. the file on my local is different from the server(logged in to Ubuntu). – putoshop Jul 23 '15 at 12:47
  • OK so how does this file relate to the git repo? – trojanfoe Jul 23 '15 at 12:48
  • On an unrelated note, this kind of file reverting is better done without messing with the commit history by using `git revert`. I have a personal preference of keeping track of reverts, since they are part of the development history after all. – SirDarius Jul 23 '15 at 12:50
  • the file exists on both local and server repo. we were able to change it many times before the 'git reset --hard' command. The history of the repo on the server is different from my local. it's like they both have a, b, c, d commits but after the reset from e, f, g, h to d, the server still has a,b,c,d,e,f,g,h and my local has a,b,c,d,i,j,k..... – putoshop Jul 23 '15 at 12:51
  • I guess I should have done the reset on the server and not locally and then fetch on the loca. – putoshop Jul 23 '15 at 12:53
  • @SirDarius, I think what you mean is to revert the files one by one? we're doing that if we are reverting few files or commits. In our case we need to revert lots of commits. Also we don't need those commits because we only test those commits and they still exists on their original local branch. – putoshop Jul 23 '15 at 12:56
  • git revert works on commits, or commit ranges, but yeah, I understand your point. I'm usually using temporary integration branches to test commits like this, so when I'm done with them, I just delete the branch without needing resets. – SirDarius Jul 23 '15 at 13:05
  • perhaps the right way of doing the reset is on the server. what I just did is reset from Terminal in the SourceTree. Right now my reso is not sync on the server. can you suggest a command that I need to run to sync local and remote repos? thanks – putoshop Jul 23 '15 at 13:10
  • I already tried pulling and fetching but still not able to sync them. – putoshop Jul 23 '15 at 13:11

0 Answers0