0

I am the only developer on this project but work on several different machines. I have a private GitHub account and commit all changes locally and then to this repo. This has worked perfectly for 6 months or so but now when I clone a repository some references are missing. It seems that the repo is out of sync with my local project and possibly with my local repo. (How do I know if my local repo is out of sync as well?) Anyway, I now need to make the remote GitHub repo match what I have in my local project. How do I do this? I have tried searching for a solution but could not find this exact scenario and do not want to have the opposite happen and accidentally sync the remote repo to my local project. I am using VS2013 and have done all commit and pull operations through this application. I am not really familiar with other git tools so if you suggest something that requires another tool, please let me know the tool you are using.

Thank you

Earl

earlxtr
  • 340
  • 3
  • 13

3 Answers3

1

I would guess that you have some branches that are not pushed or some such. You can check this by doing the following (in your local git, use your most up-to-date git, i.e. the one you did the most work early on):

git for-each-ref --format="%(refname:short) %(upstream:track)" refs/heads

Note: That line was borrowed from here - answer number 2

This will tell you if you are ahead of or behind on all of your branches. For each branch:

  • If it tells you that you are behind then you need to do a git pull <remote> <branch>.
  • If it tells you that you are ahead then you need to do a git push <remote> <branch>

Once your first local repo is up-to-date repeat this process on your other local clones.

code_fodder
  • 15,263
  • 17
  • 90
  • 167
  • When I run the first command, it just comes back with the word "master". Does this mean anything? – earlxtr Jun 22 '17 at 18:06
  • earlt@XXXXXX MINGW32 /c/Code/EngA.PriceEngine (master) $ git for-each-ref --format="%(refname:short) %(upstream:track)" refs/heads master – earlxtr Jun 22 '17 at 18:07
  • It just means that you have a local branch called 'master' and its up-to-date with the remote. If you remove the "refs/heads" part off the end it will go through the remote branches as well. Do you have many branches? Maybe you can print the output of `git branch -a`. Also can you do a `git fetch` and re-run the commands (just to make sure you are sync#d with the remote - git fetch gets all the changes from the remote (but does not merge them). – code_fodder Jun 22 '17 at 19:13
0

If you want to synchronize your local repo with git then just use git push to sync your locally committed changes to remote repository.

kk.
  • 3,747
  • 12
  • 36
  • 67
  • Everything is already committed ... that's the problem, its still out of sync. – earlxtr Jun 22 '17 at 17:22
  • Did you try pushing​ to remote? – kk. Jun 22 '17 at 17:30
  • Yes, I have committed both locally and remote...but remote is out of sync with local. Something got out of sync and I am trying to figure out how to get them back in sync. – earlxtr Jun 22 '17 at 18:03
0

It turns out that I was really on the wrong track here. I was working in VS2013 V5 on one machine and VS2013 V4 on the other. One of the Nuget packages was not compatible with V4 so it would break the nuget install and cause all the nuget references to be broken. Once I upgraded the all the clients to V5 everything worked. Thank you, Everyone for your help. I just took be a bit to figure out what was really going on.

earlxtr
  • 340
  • 3
  • 13