* Set the repository as it was on an earlier commit
@ 2009-12-25 23:09 Sergio Belkin
2009-12-25 23:24 ` Steven Noonan
2009-12-25 23:36 ` Santi Béjar
0 siblings, 2 replies; 6+ messages in thread
From: Sergio Belkin @ 2009-12-25 23:09 UTC (permalink / raw)
To: git
Hi,
Firstly merry Christmas everyone.
I am somewhat new to git, and I've found great, but still I have some
doubts about it, let's say I have the following repo with:
A---B---C---D
Being A the first commit, B the second one an D the last one.
How I do to go back to let's say... B commit status, I mean somewhat as follows:
A---B---C---D---B'
B' would be the same as B. I am not asking to do something so:
A---B---C---D to A---B losing C and D commits,
I'd like to keep on history C and D commits, can git to do that?
Thanks in advance!
--
--
Open Kairos http://www.sergiobelkin.com
Watch More TV http://sebelk.blogspot.com
Sergio Belkin -
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Set the repository as it was on an earlier commit
2009-12-25 23:09 Set the repository as it was on an earlier commit Sergio Belkin
@ 2009-12-25 23:24 ` Steven Noonan
2009-12-25 23:36 ` Santi Béjar
1 sibling, 0 replies; 6+ messages in thread
From: Steven Noonan @ 2009-12-25 23:24 UTC (permalink / raw)
To: Sergio Belkin; +Cc: git
On Fri, Dec 25, 2009 at 3:09 PM, Sergio Belkin <sebelk@gmail.com> wrote:
> Hi,
>
> Firstly merry Christmas everyone.
>
> I am somewhat new to git, and I've found great, but still I have some
> doubts about it, let's say I have the following repo with:
>
> A---B---C---D
>
> Being A the first commit, B the second one an D the last one.
>
> How I do to go back to let's say... B commit status, I mean somewhat as follows:
>
> A---B---C---D---B'
>
> B' would be the same as B. I am not asking to do something so:
>
> A---B---C---D to A---B losing C and D commits,
>
> I'd like to keep on history C and D commits, can git to do that?
>
> Thanks in advance!
>
git revert D
git revert C
Maybe? It would create two revert commits, but it would get you back
to the state of B.
- Steven
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Set the repository as it was on an earlier commit
2009-12-25 23:09 Set the repository as it was on an earlier commit Sergio Belkin
2009-12-25 23:24 ` Steven Noonan
@ 2009-12-25 23:36 ` Santi Béjar
2009-12-26 14:28 ` Matthieu Moy
1 sibling, 1 reply; 6+ messages in thread
From: Santi Béjar @ 2009-12-25 23:36 UTC (permalink / raw)
To: Sergio Belkin; +Cc: git
On Sat, Dec 26, 2009 at 12:09 AM, Sergio Belkin <sebelk@gmail.com> wrote:
> Hi,
>
> Firstly merry Christmas everyone.
>
> I am somewhat new to git, and I've found great, but still I have some
> doubts about it, let's say I have the following repo with:
>
> A---B---C---D
>
> Being A the first commit, B the second one an D the last one.
>
> How I do to go back to let's say... B commit status, I mean somewhat as follows:
>
> A---B---C---D---B'
>
> B' would be the same as B. I am not asking to do something so:
>
> A---B---C---D to A---B losing C and D commits,
>
> I'd like to keep on history C and D commits, can git to do that?
I don't know if it is possible with porcelain commands, but with
plumbing you can:
# begin with a clean working dir
git read-tree B
git commit
git reset --hard
HTH,
Santi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Set the repository as it was on an earlier commit
2009-12-25 23:36 ` Santi Béjar
@ 2009-12-26 14:28 ` Matthieu Moy
2009-12-28 4:19 ` Sergio Belkin
0 siblings, 1 reply; 6+ messages in thread
From: Matthieu Moy @ 2009-12-26 14:28 UTC (permalink / raw)
To: Santi Béjar; +Cc: Sergio Belkin, git
Santi Béjar <santi@agolina.net> writes:
> I don't know if it is possible with porcelain commands, but with
> plumbing you can:
>
> # begin with a clean working dir
> git read-tree B
> git commit
> git reset --hard
I guess
(at the root of the repo)
git checkout B -- .
# git status if you want to check.
git commit
does this. The "-- ." part of "git checkout" asks Git to checkout the
files, but the path limiter prevents it from updating HEAD, so the
HEAD still points to the tip of the branch.
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Set the repository as it was on an earlier commit
2009-12-26 14:28 ` Matthieu Moy
@ 2009-12-28 4:19 ` Sergio Belkin
2009-12-28 5:18 ` Fwd: " Sergio Belkin
0 siblings, 1 reply; 6+ messages in thread
From: Sergio Belkin @ 2009-12-28 4:19 UTC (permalink / raw)
To: git
2009/12/26 Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>:
> Santi Béjar <santi@agolina.net> writes:
>
>> I don't know if it is possible with porcelain commands, but with
>> plumbing you can:
>>
>> # begin with a clean working dir
>> git read-tree B
>> git commit
>> git reset --hard
>
> I guess
>
> (at the root of the repo)
>
> git checkout B -- .
> # git status if you want to check.
> git commit
>
> does this. The "-- ." part of "git checkout" asks Git to checkout the
> files, but the path limiter prevents it from updating HEAD, so the
> HEAD still points to the tip of the branch.
>
> --
> Matthieu Moy
> http://www-verimag.imag.fr/~moy/
>
Sorry but really answer given by Steven was better, because last one
omit the case when B had less files that D for example...
Thanks everyone
--
--
Open Kairos http://www.sergiobelkin.com
Watch More TV http://sebelk.blogspot.com
Sergio Belkin -
^ permalink raw reply [flat|nested] 6+ messages in thread
* Fwd: Set the repository as it was on an earlier commit
2009-12-28 4:19 ` Sergio Belkin
@ 2009-12-28 5:18 ` Sergio Belkin
0 siblings, 0 replies; 6+ messages in thread
From: Sergio Belkin @ 2009-12-28 5:18 UTC (permalink / raw)
To: git
Ooops I wanted to say Santi answer was the best
---------- Forwarded message ----------
From: Sergio Belkin <sebelk@gmail.com>
Date: 2009/12/28
Subject: Re: Set the repository as it was on an earlier commit
To: git@vger.kernel.org
2009/12/26 Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>:
> Santi Béjar <santi@agolina.net> writes:
>
>> I don't know if it is possible with porcelain commands, but with
>> plumbing you can:
>>
>> # begin with a clean working dir
>> git read-tree B
>> git commit
>> git reset --hard
>
> I guess
>
> (at the root of the repo)
>
> git checkout B -- .
> # git status if you want to check.
> git commit
>
> does this. The "-- ." part of "git checkout" asks Git to checkout the
> files, but the path limiter prevents it from updating HEAD, so the
> HEAD still points to the tip of the branch.
>
> --
> Matthieu Moy
> http://www-verimag.imag.fr/~moy/
>
Sorry but really answer given by Steven was better, because last one
omit the case when B had less files that D for example...
Thanks everyone
--
--
Open Kairos http://www.sergiobelkin.com
Watch More TV http://sebelk.blogspot.com
Sergio Belkin -
--
--
Open Kairos http://www.sergiobelkin.com
Watch More TV http://sebelk.blogspot.com
Sergio Belkin -
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-12-28 5:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-25 23:09 Set the repository as it was on an earlier commit Sergio Belkin
2009-12-25 23:24 ` Steven Noonan
2009-12-25 23:36 ` Santi Béjar
2009-12-26 14:28 ` Matthieu Moy
2009-12-28 4:19 ` Sergio Belkin
2009-12-28 5:18 ` Fwd: " Sergio Belkin
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).