On Thu, Sep 3, 2015 at 7:37 PM, Konstantin Khomoutov <
> On Thu, 3 Sep 2015 19:16:23 +0300
> Ram Rachum <ram.rac...@gmail.com> wrote:
> > > 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.
> > 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?
> The documentation says that the unadorned --force-with-lease looks at
> the remote-tracking branch for the target ref (a branch in your case),
> if this exists, and requires the tip of the target ref to be the same
> as the tip of this remote-tracking branch.
> IOW, if you're pushing to "test-lease" with plain --force-with-lease,
> `git push` will try to locate the "remotes/origin/test-lease" branch
> and then require that the remote "test-lease" branch points to the same
> commit your "remotes/origin/test-lease" points to.
> This means that if you did rebase your local "test-lease" and then
> did `git fetch`, you've updated your "remotes/origin/test-lease"
> with the current "upstream" tip commit of that branch and the check
> passed when you pushed.
> So, could you somehow verify that?
> You could also try the two argument form of --force-with-lease.
I'm really lost in your reply. I had a problem: I want to have a push
command that (1) works even after a rebase and (2) refuses to push when
there's a new commit in the remote branch that doesn't exist in the local
branch. I thought you suggested that `--force-with-lease` is a solution.
Currently it seems to fail requirement 2, so there's no point in talking
about requirement 1, so there's no point in talking about rebasing at all.
Is there a way to use `--force-with-lease` so it satisfies requirement 2?
If you want me to try arguments, then which arguments? (Sorry I'm too lost
to understand which arguments I should put there.)
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
For more options, visit https://groups.google.com/d/optout.