On Thu, Sep 3, 2015 at 6:58 PM, Konstantin Khomoutov < [email protected]> wrote:
> On Thu, 3 Sep 2015 05:17:34 -0700 (PDT) > Ram Rachum <[email protected]> wrote: > > > Is there a way to avoid this? (Aside from pre-checking manually on > > the repo using `git fetch`.) I want something like `push --force` > > except it doesn't discard actual commits, only commits that have been > > reordered due to rebasing. > > Yes, since some version `git push` learned the --force-with-lease > command-line option which does just what you want: makes sure the tip > of the existing branch is exactly what you expect it to be. > Hi Konstantin, I was very happy to see this portion of your message because I figured you found a solution to my problem, but I tried it now and it didn't work. It pushes alright, but it happily runs over other changes that were pushed to the remote. I had a situation like this: http://i.imgur.com/sn8oScu.jpg Then ran this: $ git push origin test-lease --force-with-lease Counting objects: 2, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (2/2), 244 bytes | 0 bytes/s, done. Total 2 (delta 1), reused 0 (delta 0) To [REDACTED] f7127f4..282393a test-lease -> test-lease Then I got this: http://i.imgur.com/7iq5qRJ.jpg So as you can see, the commit f7127 was thrown away. Perhaps I misunderstood how `--force-with-lease` is supposed to work? Thanks, Ram. -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
