On Fri, Nov 15, 2013 at 5:58 PM, Kornel Benko <kor...@lyx.org> wrote:
> Am Mittwoch, 13. November 2013 um 10:31:53, schrieb Vincent van Ravesteijn > <v...@lyx.org> > > > > > The errors will not be the result of a 'git checkout' command. It more > > looks like a git pull. This is the reason, I don't advice to use git > pull. > > > > If you would have done a 'git fetch', you will retrieve the new commits. > > Then, you want to reset the features/chat2 branch to the new one tommasso > > pushed: > > > > $ git checkout features/chat2 > > $ git reset --hard <name_of_remote>/features/chat2 > > > > This must work without problems. > > > > Vincent > > Sure Vincent. If one knows how. > > For some days I was not looking at this branch. > I am really trying hard but: > > #git reset --hard features/chat2 > HEAD is now at 2993f12 whitespaces > #git fetch > You already had fetched the branch before, and git should have told you then (by head): <sha1> -> <sha1> (forced update). This (forced update) tells you that the branch has rewritten part of the history, and you should either: - rebase your commits on top of the remote branch, or - reset your branch to the remote branch. If you now merge with the remote branch, you will have a lot of commits in your history that have two different sha1s. > #git status > # On branch features/chat2 > # Your branch and 'origin/features/chat2' have diverged, > # and have 16 and 33 different commits each, respectively. > # > nothing to commit (working directory clean) > Again, the fact that the branches have been diverged tells you the same thing as above. > #git branch > * features/chat2 > master > #git pull > Pulling is not a good idea if the branched are diverged / rewritten, because this merges two branches with almost the same commits but that have different sha1s. > > What the mockery ... Nothing I try helps here. I for sure did not commit > or change anything. > The resolution would be (assuming the remote that points to tommaso's repo is called "tommaso"): $ git checkout features/chat2 $ git rebase tommaso/features/chat2 (depending on the degree of changes in the remote, this might auto-detect which commits were already in the new remote branch and which are new commits). or $ git checkout features/chat2 $ git rebase --onto tommaso/features/chat2 HEAD~4 HEAD (this manually tells git which commits were your own and should be rebased on top of the remote branch). or $ git checkout features/chat2 $ git reset --hard tommaso/features/chat2 (this throws away your local commits and changes) Vincent