Re: [git-users] Problems pushing -- remote branch went backwards "in time"

2016-07-09 Thread Torsten Anders
> $ git merge origin-master
> Already up-to-date.

Sorry, my bad, I simple did not change into the master branch before doing 
the above. 

Thanks again for helping.

Best,
Torsten

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Problems pushing -- remote branch went backwards "in time"

2016-07-09 Thread Torsten Anders
Thanks for your response. I can see now that both at GitHub and locally I 
have indeed a new and an old branch. 

Old: master; or remote/origin/master 

New: origin-master; or remotes/origin/origin-master

I tried doing the following in the hope to bring both branches together 
again, but seemingly I misunderstood something, as that does not result in 
any change. 

$ git merge origin-master
Already up-to-date.

Sorry, but how do I merge these branches again? 

Best,
Torsten

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Problems pushing -- remote branch went backwards "in time"

2016-07-09 Thread Philip Oakley
The likely reason is that at some point you either --amend/ed a commit or 
rebased a few commits, such that the copy that Github had was no longer up to 
date with what you had locally.

You have now done some extra work locally on top of that changed commit and 
github is sayin that what it had as the tip of master is "ahead" of your series 
(it says you are behind, or at least took a side turn).

The good news is that becuase of the 'pull' (which is fetch then merge), you 
will have a local copy of what was at Github, even though later you overwrote 
it (that copy) with the --force.

The branch origin/master (assuming normal conventions) should be the old 
version (held locally). It takes a moment or two to realise that 'rtb's (remote 
tracking branches) are actually your local copy!.

To get a visualisation of your project, try using the `gitk` tool (via the 
command line) as `gitk --all &` (tidbit: the & allows you to continue with the 
command line and use gitk at the same time)

hope this helps

Philip
  - Original Message - 
  From: Torsten Anders 
  To: Git for human beings 
  Sent: Saturday, July 09, 2016 12:48 PM
  Subject: [git-users] Problems pushing -- remote branch went backwards "in 
time"


  Dear all,

  I need some help to get some git repository back to functioning properly.

  I am developing some project completely on my own, and I have a local and a 
remove repository/branch (the latter at GitHub). I started development two 
years ago, then the project paused for a while, and now I wanted to push a few 
more commits. I was surprised to get the following error message.

  $ git push
  To g...@github.com:user/project.git
   ! [rejected]master -> master (non-fast-forward)
  error: failed to push some refs to 'g...@github.com:user/project.git'
  hint: Updates were rejected because a pushed branch tip is behind its remote
  hint: counterpart. Check out this branch and integrate the remote changes
  hint: (e.g. 'git pull ...') before pushing again.
  hint: See the 'Note about fast-forwards' in 'git push --help' for details.

  No-one except me ever pushed anything to the remove branch, so I had no idea 
where this came from. I tried to do what the error message said. Everything was 
up-to-date as expected. 

  $ git pull
  Already up-to-date.

  I again tried to push, but still got the same error message as above. So, I 
searched for possible solutions in the git documentation and online, and then I 
did what some recommended, because I knew as the only developer I could not 
overwrite the work of anyone else. Before doing this, my local branch was 17 
commits ahead of the remote branch.

  $ git push --force
  Total 0 (delta 0), reused 0 (delta 0)
  To g...@github.com:user/project.git
   + d28162f...e083c14 master -> master (forced update)

  Unfortunately, this did not work out as planned, instead of pushing the new 
17 commits to the remote branch, the remote branch went back to an older 
version now 34 commits behind my local branch.

  $ git status
  On branch origin-master
  Your branch is ahead of 'origin/master' by 34 commits.
(use "git push" to publish your local commits)
  nothing to commit, working directory clean

  Now, before accidentally actually ruining anything I decided to better ask 
this mailing list. What do you suggest in this situation. 

  Thanks a lot! 

  Best,
  Torsten Anders

  PS: I am using git version 2.0.1 on OS X (10.9.5). I may add that in addition 
to invoking git directly at the command line I commonly use the Emacs package 
magit. I assume I updated that package during the two years before the new push 
trial, and I tried pushing with magit first. Not sure whether that could have 
caused some problem.  



  -- 
  You received this message because you are subscribed to the Google Groups 
"Git for human beings" group.
  To unsubscribe from this group and stop receiving emails from it, send an 
email to git-users+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.