git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Phil Hord <phil.hord@gmail.com>
To: Geoffrey De Smet <ge0ffrey.spam@gmail.com>
Cc: git@vger.kernel.org, Ramkumar Ramachandra <artagnon@gmail.com>
Subject: Re: git reset respect remote repo (make git idiot proof)
Date: Wed, 3 Oct 2012 12:40:00 -0400	[thread overview]
Message-ID: <CABURp0qVWg2PvD4PcjJ9q45x9WxJCuJEQL8Rze=qerWXg72Txw@mail.gmail.com> (raw)
In-Reply-To: <k4hj91$4tt$4@ger.gmane.org>

On Wed, Oct 3, 2012 at 10:49 AM, Geoffrey De Smet
<ge0ffrey.spam@gmail.com> wrote:
> Suppose this case:
>
> git clone .../blessedRepo.git
> // do changes
> git commit -m"bad1"
> // do changes
> git commit -m"bad2"
> git reset --hard HEAD^4 // Why does it let me do this?
>
> // I just "broke" my local repository, because if I continue
>
> // do changes
> git commit -m"good1"
> git push origin master // fails because the history disrespects the remote
> repo's history
>
> The following commands are ok to do (because I have 2 unpushed commits):
>  git reset --hard^1
>  git reset --hard^2
> but these are not and should be prevented (unless forced):
>  git reset --hard^3
>  git reset --hard^4
>
>
> Is there any way to make git idiot proof by enabling that the local repo
> should always respect the history of the remote repo (unless forced)?
> Is there any way to make this a default for anyone who clones our blessed
> repo?

I suppose if we go down this path we must also prevent users from
having any local branches whose names match those used on the remote
unless the remote branches are also ancestors of our local branch.
But then we may get into trouble when we pull new branches which now
conflict but previously did not.

I'm afraid this is a Pandora's box of woes.

But I feel your pain.  I think the solution lies in relegating 'reset'
to the plumbing or the power-user realm of commands since I feel it is
quite overloaded and sometimes dangerous.  There was a thread some
months back heading in this direction, but I failed to keep it going.

    http://comments.gmane.org/gmane.comp.version-control.git/185825


Phil

  parent reply	other threads:[~2012-10-03 16:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-03 14:49 git reset respect remote repo (make git idiot proof) Geoffrey De Smet
2012-10-03 14:59 ` Ramkumar Ramachandra
2012-10-03 15:12   ` Geoffrey De Smet
2012-10-03 16:40 ` Phil Hord [this message]
2012-10-04  8:59   ` Geoffrey De Smet
2012-10-05  3:11     ` Junio C Hamano
2012-10-05  5:35     ` Dirk Heinrichs
2012-10-03 16:52 ` Andreas Schwab
2012-10-04  8:56   ` Geoffrey De Smet

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to='CABURp0qVWg2PvD4PcjJ9q45x9WxJCuJEQL8Rze=qerWXg72Txw@mail.gmail.com' \
    --to=phil.hord@gmail.com \
    --cc=artagnon@gmail.com \
    --cc=ge0ffrey.spam@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).