git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Geoffrey De Smet <ge0ffrey.spam@gmail.com>
To: git@vger.kernel.org
Subject: Re: git reset respect remote repo (make git idiot proof)
Date: Thu, 04 Oct 2012 10:56:04 +0200	[thread overview]
Message-ID: <k4jiv4$5k9$1@ger.gmane.org> (raw)
In-Reply-To: <m2bogja46v.fsf@igel.home>


Op 03-10-12 18:52, Andreas Schwab schreef:
> Geoffrey De Smet <ge0ffrey.spam@gmail.com> writes:
>
>> 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?
> Because there is nothing wrong with that.
>
>> // I just "broke" my local repository, because if I continue
> No you didn't.
>
>> // do changes
>> git commit -m"good1"
>> git push origin master // fails because the history disrespects the remote
>> repo's history
> You may just as well want to push it to a different branch (or even a
> different repository).
In most cases (probably more than 90%?), the developer will want to get 
his changes into the remote branch where it came from.

What do you think of the -respectRepository flag idea? If you want to 
push to different branches/repo's you can not use it, turn it off or 
-force those commands.

A remote repository can be optionally flagged with -respectRepository.
That means that git should prevent the user from making local changes in 
the history that will prevent a normal push to that remote repository.

If a remote repository is flagged as such, git keeps track of a 
"pointOfNoReset" commit:
Every time a branch merges or rebases with a remote repository, it's 
flags the last commit of that remote repository as the pointOfNoReset 
commit.
If local branches merge or rebase with a local branch, the 
pointOfNoReset commit is transitively applied (only the last one wins).
git reset will fail to reset beyond the pointOfNoReset commit, unless 
forced.
git rebase and other git commands will also fail accordingly, unless forced.

>
> Andreas.
>

      reply	other threads:[~2012-10-05  1:30 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
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 [this message]

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='k4jiv4$5k9$1@ger.gmane.org' \
    --to=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).