Today's github tip - fixing local master

Walter Bright newshound2 at digitalmars.com
Tue Jun 18 13:58:50 PDT 2013


On 6/18/2013 1:52 PM, Jacob Carlborg wrote:
> On 2013-06-18 21:41, Walter Bright wrote:
>
>> 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.
>
> I don't know what you are doing with your git repositories but you shouldn't
> have to do a push force (push -f). That's only needed if you changed the
> history, which "git reset" will do. Instead just sync all:
>
> 1. sync local with origin:
>
> git checkout master
> git pull
> git push origin master

That didn't work.


> 2. sync upstream with master
>
> git checkout master
> git fetch upstream
> git merge upstream/master
> git push upstream master

I didn't try that one.

> 3. sync upstream with origin
>
> git push origin master

That didn't work, either.


> If you have changed the history in any of the repository the above won't work.

Hence my problems with it.


> I also recommend doing all your work in a special branch (not master) or topic
> branches.

I do do all the work in not-master branches. But I make mistakes, and often 
forget to change branches first. Most of my problems with git revolve around 
trying to undo mistakes.



More information about the Digitalmars-d mailing list