git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* rebase destroys branches
@ 2013-03-04 23:06 Gene Thomas [DATACOM]
  2013-03-04 23:43 ` Philip Oakley
  0 siblings, 1 reply; 5+ messages in thread
From: Gene Thomas [DATACOM] @ 2013-03-04 23:06 UTC (permalink / raw)
  To: git@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 601 bytes --]

Hello,
          I am evaluating git for use in a company. Please correct if I am wrong. I am concerned that an inexperienced developer could mistakenly rebase branches, destroying the original branch. Attached is a script (Windoze) that shows the 'topic' branch being moved!, after the rebase we are unable to see the original branch, read it's history or find it's commit points.

Surely no operation should remove anything from the repository. Operations like this irreversibly break the repository . When rebasing the original branch must be retained.

Yours faithfully,


Gene Thomas.


[-- Attachment #2: git-test.bat --]
[-- Type: application/octet-stream, Size: 1196 bytes --]


rem https://www.kernel.org/pub/software/scm/git/docs/git-rebase.html

rem (c) 2013 Gene Thomas
rem Datacom
rem Gene.Thomas@datacom.co.nz

if exist "git-test" rmdir /q /s git-test
mkdir git-test
cd git-test
git init

rem ==========================

echo d > d.txt
git add d.txt
git tag d
git commit -a -m d

echo e > e.txt
git add e.txt
git tag e
git commit -a -m e

git branch topic
git checkout topic

echo a > a.txt
git add a.txt
git tag a
git commit -m a

echo b > b.txt
git add b.txt
git tag b
git tag v2.0
git commit -a -m b

echo c > c.txt
git add c.txt
git tag c
git commit -a -m c

git log

rem ==========================

git checkout master

echo f > f.txt
git add f.txt
git tag f
git commit -a -m f

echo g > g.txt
git add g.txt
git tag g
git commit -a -m g

rem ==========================

git checkout topic
git rebase master

git log

rem ==========================

git checkout v2.0
git branch
rem we are on the "(no branch)" psuedo branch

rem origional 'topic' branch is lost
rem commits are still in the repositry
rem but can only be referenced by hash or tag
rem a mistake would destroy the history

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: rebase destroys branches
  2013-03-04 23:06 rebase destroys branches Gene Thomas [DATACOM]
@ 2013-03-04 23:43 ` Philip Oakley
  2013-03-05  1:05   ` Gene Thomas [DATACOM]
  0 siblings, 1 reply; 5+ messages in thread
From: Philip Oakley @ 2013-03-04 23:43 UTC (permalink / raw)
  To: Gene Thomas [DATACOM], Git List

From: "Gene Thomas [DATACOM]" <Gene.Thomas@datacom.co.nz>
Sent: Monday, March 04, 2013 11:06 PM
>Hello,
>I am evaluating git for use in a company. Please correct if I am wrong.
>I am concerned that an inexperienced developer could mistakenly rebase
>branches, destroying the original branch.

The original branch is not 'destroyed', rather the pointer to the 
previous tip is within the logs. All the content is still available 
until the logs expire.

>   Attached is a script (Windoze)
>that shows the 'topic' branch being moved!, after the rebase we are
>unable to see the original branch, read it's history or find it's 
>commit
>points.

>Surely no operation should remove anything from the repository.
>Operations like this irreversibly break the repository . When rebasing
>the original branch must be retained.

It's easy to misread some of Git's strengths if you have come from other 
historic corporate 'version control systems' which are often based on 
drawing office practice of old (e.g. the belief there is a single master 
to be protected is one misconception for software).

Rebase, at the personal level, is an important mechanism for staff to 
prepare better code and commit messages. Trying to hide the reality will 
just make your management 'control' less effective as staff work around 
it and delay check-ins, etc.

The broader access control and repo management issues are deliberately 
not part of Git, and there are good tools for that. e.g. Gitolite.

>Yours faithfully,


>Gene Thomas.

Philip

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: rebase destroys branches
  2013-03-04 23:43 ` Philip Oakley
@ 2013-03-05  1:05   ` Gene Thomas [DATACOM]
  2013-03-05  2:21     ` Theodore Ts'o
  2013-03-05 22:04     ` Philip Oakley
  0 siblings, 2 replies; 5+ messages in thread
From: Gene Thomas [DATACOM] @ 2013-03-05  1:05 UTC (permalink / raw)
  To: Philip Oakley, Git List

Philip,
        Thanks for your reply.

>The original branch is not 'destroyed', rather the pointer to the previous tip is within the logs. 

Is that the 'git log' log or internal logs? Are you sure? There doesn't appear to be a way to checkout that tip of see the log back from that tip.

>All the content is still available until the logs expire.

So we will be unable to checkout content after a time?

Gene Thomas.

-----Original Message-----
From: Philip Oakley [mailto:philipoakley@iee.org] 
Sent: Tuesday, 5 March 2013 12:44
To: Gene Thomas [DATACOM]; Git List
Subject: Re: rebase destroys branches

From: "Gene Thomas [DATACOM]" <Gene.Thomas@datacom.co.nz>
Sent: Monday, March 04, 2013 11:06 PM
>Hello,
>I am evaluating git for use in a company. Please correct if I am wrong.
>I am concerned that an inexperienced developer could mistakenly rebase 
>branches, destroying the original branch.

The original branch is not 'destroyed', rather the pointer to the previous tip is within the logs. All the content is still available until the logs expire.

>   Attached is a script (Windoze)
>that shows the 'topic' branch being moved!, after the rebase we are 
>unable to see the original branch, read it's history or find it's 
>commit points.

>Surely no operation should remove anything from the repository.
>Operations like this irreversibly break the repository . When rebasing 
>the original branch must be retained.

It's easy to misread some of Git's strengths if you have come from other historic corporate 'version control systems' which are often based on drawing office practice of old (e.g. the belief there is a single master to be protected is one misconception for software).

Rebase, at the personal level, is an important mechanism for staff to prepare better code and commit messages. Trying to hide the reality will just make your management 'control' less effective as staff work around it and delay check-ins, etc.

The broader access control and repo management issues are deliberately not part of Git, and there are good tools for that. e.g. Gitolite.

>Yours faithfully,


>Gene Thomas.

Philip

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: rebase destroys branches
  2013-03-05  1:05   ` Gene Thomas [DATACOM]
@ 2013-03-05  2:21     ` Theodore Ts'o
  2013-03-05 22:04     ` Philip Oakley
  1 sibling, 0 replies; 5+ messages in thread
From: Theodore Ts'o @ 2013-03-05  2:21 UTC (permalink / raw)
  To: Gene Thomas [DATACOM]; +Cc: Philip Oakley, Git List

On Tue, Mar 05, 2013 at 02:05:32PM +1300, Gene Thomas [DATACOM] wrote:
> 
> >The original branch is not 'destroyed', rather the pointer to the previous tip is within the logs. 
> 
> Is that the 'git log' log or internal logs? Are you sure? There doesn't appear to be a way to checkout that tip of see the log back from that tip.

See the dovcumentation for "git reflog"

> >All the content is still available until the logs expire.
> 
> So we will be unable to checkout content after a time?

You need to make a distinction between a user's local repository, and
the team's central repository.  The workflow of the individual user is
one where they can and should be allowed to use rebase and "git commit
--amend" if they like.  Consider this the same thing as the user who
chooses to use "quilt" on their local machine while they are preparing
their patches, so they are carefully honed before they are cast into
concrete.  Whether they use "quilt", or manual patching, or simply
don't bother checking things into the central SCM until things are
cleaned up, the end result is the same.

The team's central repository is one where you don't want to allow
history to be lost, and so there you can enforce rules to prevent
this.  For example, if you use Gerrit, you can limit the ability to
reset branches to administrators only.  Everyone else can only add new
commits, not change older ones.

(If someone accidentally checks in NDA'ed material belonging to
someone else, or some other IP content guaranteed to cause your
general counsel to have heart palpitations, trust me, you'll want to
allow administrators to rewind a git branch.  :-)

You can also use Gerrit to enforce code reviews, so that no change
goes in until a second engineer reviews the commit and gives it a
thumbs up (with a permanent record of the code review kept in Gerrit,
something which can be important for pointy-haired corporate types who
worry about Sarbanes Oxley controls --- although from your e-mail
address, you may be lucky enough to be exempt from needing to worry
about SOX controls :-).

Regards,

						- Ted

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: rebase destroys branches
  2013-03-05  1:05   ` Gene Thomas [DATACOM]
  2013-03-05  2:21     ` Theodore Ts'o
@ 2013-03-05 22:04     ` Philip Oakley
  1 sibling, 0 replies; 5+ messages in thread
From: Philip Oakley @ 2013-03-05 22:04 UTC (permalink / raw)
  To: Gene Thomas [DATACOM], Git List

From: "Gene Thomas [DATACOM]" <Gene.Thomas@datacom.co.nz>
Sent: Tuesday, March 05, 2013 1:05 AM
> Philip,
>        Thanks for your reply.
>
>>The original branch is not 'destroyed', rather the pointer to the
>>previous tip is within the logs.
>
> Is that the 'git log' log or internal logs? Are you sure? There
> doesn't appear to be a way to checkout that tip of see the log back
> from that tip.

Double checking the [rebase] manual page... [The ref] "ORIG_HEAD is set
to point at the tip of the branch before the reset."

So your original branch starts there (I just checked one of mine).
Obviously this is only for the machine that did the rebase, and only has
the last rebase tip. But then until it's pushed to an open repo no one 
knows ;-)

>
>>All the content is still available until the logs expire.
>
> So we will be unable to checkout content after a time?
>
> Gene Thomas.
>
> -----Original Message-----
> From: Philip Oakley [mailto:philipoakley@iee.org]
> Sent: Tuesday, 5 March 2013 12:44
> To: Gene Thomas [DATACOM]; Git List
> Subject: Re: rebase destroys branches
>
> From: "Gene Thomas [DATACOM]" <Gene.Thomas@datacom.co.nz>
> Sent: Monday, March 04, 2013 11:06 PM
>>Hello,
>>I am evaluating git for use in a company. Please correct if I am
>>wrong.
>>I am concerned that an inexperienced developer could mistakenly rebase
>>branches, destroying the original branch.
>
> The original branch is not 'destroyed', rather the pointer to the
> previous tip is within the logs. All the content is still available
> until the logs expire.
>
>>   Attached is a script (Windoze)
>>that shows the 'topic' branch being moved!, after the rebase we are
>>unable to see the original branch, read it's history or find it's
>>commit points.
>
>>Surely no operation should remove anything from the repository.
>>Operations like this irreversibly break the repository . When rebasing
>>the original branch must be retained.
>
> It's easy to misread some of Git's strengths if you have come from
> other historic corporate 'version control systems' which are often
> based on drawing office practice of old (e.g. the belief there is a
> single master to be protected is one misconception for software).
>
> Rebase, at the personal level, is an important mechanism for staff to
> prepare better code and commit messages. Trying to hide the reality
> will just make your management 'control' less effective as staff work
> around it and delay check-ins, etc.
>
> The broader access control and repo management issues are deliberately
> not part of Git, and there are good tools for that. e.g. Gitolite.
>
>>Yours faithfully,
>
>
>>Gene Thomas.
>
> Philip
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-03-05 22:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-04 23:06 rebase destroys branches Gene Thomas [DATACOM]
2013-03-04 23:43 ` Philip Oakley
2013-03-05  1:05   ` Gene Thomas [DATACOM]
2013-03-05  2:21     ` Theodore Ts'o
2013-03-05 22:04     ` Philip Oakley

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).