Today's github tip - fixing local master

Walter Bright newshound2 at digitalmars.com
Tue Jun 18 12:41:55 PDT 2013


I often struggle with understanding how github works. A problem I was having 
often is that I have 3 repositories to deal with:

    1. the main one on github (upstream)
    2. my github fork of the main one (origin)
    3. my local git repository

and (2) and (3) got out of sync with (1), causing all my pull requests to go 
bonkers. What I needed was a "fix (2) and (3) so their masters are identical to 
(1)'s master." Various attempts at fixing it all failed in one way or another, 
often with mysterious messages, and cost me a lot of time.

yebblies (Daniel Murphy) provided the solution, which is nicely generic:

   git checkout master
   git fetch upstream master
   git reset --hard FETCH_HEAD
   git push origin master -f

So there it is if anyone else has this problem.


More information about the Digitalmars-d mailing list