git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Subject: [RFD] Rewriting safety - warn before/when rewriting published history
Date: Sat, 4 Feb 2012 20:45:53 +0100	[thread overview]
Message-ID: <201202042045.54114.jnareb@gmail.com> (raw)

Git includes protection against rewriting published history on the 
receive side with fast-forward check by default (which can be 
overridden) and various receive.deny* configuration variables,
including receive.denyNonFastForwards.

Nevertheless git users requested (among others in Git User's Survey) 
more help on creation side, namely preventing rewriting parts of 
history which was already made public (or at least warning that one is 
about to rewrite published history).  The "warn before/when rewriting 
published history" answer in "17. Which of the following features would 
you like to see implemented in git?" multiple-choice question in latest
Git User's Survey 2011[1] got 24% (1525) responses.

[1]: https://www.survs.com/results/Q5CA9SKQ/P7DE07F0PL

So people would like for git to warn them about rewriting history before 
they attempt a push and it turns out to not fast-forward.


What prompted this email is the fact that Mercurial includes support for 
tracking which revisions (changesets) are safe to modify in its 2.1 
latest version:

  http://lwn.net/Articles/478795/
  http://mercurial.selenic.com/wiki/WhatsNew

It does that by tracking so called "phase" of a changeset (revision).

  http://mercurial.selenic.com/wiki/Phases
  http://mercurial.selenic.com/wiki/PhasesDevel

  http://www.logilab.org/blogentry/88203
  http://www.logilab.org/blogentry/88219
  http://www.logilab.org/blogentry/88259
  

While we don't have to play catch-up with Mercurial features, I think 
something similar to what Mercurial has to warn about rewriting 
published history (amend, rebase, perhaps even filter-branch) would
be nice to have.  Perhaps even follow UI used by Mercurial, and/or
translating its implementation into git terms.

In Mercurial 2.1 there are three available phases: 'public' for
published commits, 'draft' for local un-published commits and
'secret' for local un-published commits which are not meant to
be published.

The phase of a changeset is always equal to or higher than the phase
of it's descendants, according to the following order:

      public < draft < secret

Commits start life as 'draft', and move to 'public' on push.

Mercurial documentation talks about phase of a commit, which might
be a good UI, ut also about commits in 'public' phase being "immutable".
As commits in Git are immutable, and rewriting history is in fact
re-doing commits, this description should probably be changed.

While default "push matching" behavior makes it possible to have 
"secret" commits, being able to explicitly mark commits as not for
publishing might be a good idea also for Git.


What do you think about this?
-- 
Jakub Narebski
Poland

             reply	other threads:[~2012-02-04 19:46 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-04 19:45 Jakub Narebski [this message]
2012-02-05 14:33 ` [RFD] Rewriting safety - warn before/when rewriting published history Ben Walton
2012-02-05 15:05   ` Jakub Narebski
     [not found] ` <CAFA910035B74E56A52A96097E76AC39@PhilipOakley>
2012-02-05 16:15   ` Jakub Narebski
2012-02-05 17:29     ` Johan Herland
2012-02-05 20:46       ` Jakub Narebski
2012-02-05 22:49         ` Johan Herland
2012-02-06 14:44           ` Jakub Narebski
2012-02-06 15:59             ` Johan Herland
2012-02-06 17:14               ` Jakub Narebski
2012-02-06 20:16                 ` Johan Herland
2012-02-07 14:31                   ` Jakub Narebski
2012-02-07 15:09                     ` Johan Herland
2012-02-10 19:38                       ` Jakub Narebski
2012-02-10 20:19                         ` Philip Oakley
2012-02-11 13:10                         ` Johan Herland
2012-02-11 13:45                           ` Jakub Narebski
2012-02-20 21:07                             ` [RFC] pre-rebase: Refuse to rewrite commits that are reachable from upstream Johan Herland
2012-02-20 21:21                               ` Johan Herland
2012-02-20 22:43                               ` Junio C Hamano
2012-02-21  0:03                                 ` Johan Herland
2012-02-21  7:44                                   ` Junio C Hamano
2012-02-21 23:23                                     ` Johan Herland
2012-02-21 23:43                                       ` Junio C Hamano
2012-02-21 23:59                                         ` Dave Zarzycki
2012-02-22  7:09                                           ` Jeff King
2012-02-22  8:00                                             ` Dave Zarzycki
2012-04-07 15:01                           ` [RFD] Rewriting safety - warn before/when rewriting published history Steven Michalske
2012-04-07 14:49                       ` Steven Michalske
2012-02-07 17:27                     ` Ronan Keryell
2012-02-06  0:57 ` Steven Michalske
2012-02-06  6:53   ` Johan Herland
2012-02-06 13:45   ` Jakub Narebski
2012-04-07 14:36     ` Steven Michalske

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201202042045.54114.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).