* cogito - how to drop a commit
@ 2005-08-06 22:34 Sam Ravnborg
2005-08-07 0:42 ` Linus Torvalds
2005-08-11 21:59 ` Petr Baudis
0 siblings, 2 replies; 3+ messages in thread
From: Sam Ravnborg @ 2005-08-06 22:34 UTC (permalink / raw)
To: git
I accidently commited too many files to my tree today, and now I want to
drop the commit so I have logically separate commits.
What is the right way to do this - in cogito hopefully.
I do not mind to execute a few git commands, but for my daily usage I
expect cogito to hanle everything and dropping a commit has proved
useful for me from time to time, so I expect it be be implemented in the
porcelain somehow.
I have read the help for cg-seek - but it di not convince me to be what
I seeked.
Sam
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: cogito - how to drop a commit
2005-08-06 22:34 cogito - how to drop a commit Sam Ravnborg
@ 2005-08-07 0:42 ` Linus Torvalds
2005-08-11 21:59 ` Petr Baudis
1 sibling, 0 replies; 3+ messages in thread
From: Linus Torvalds @ 2005-08-07 0:42 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: git
On Sun, 7 Aug 2005, Sam Ravnborg wrote:
>
> I accidently commited too many files to my tree today, and now I want to
> drop the commit so I have logically separate commits.
>
> What is the right way to do this - in cogito hopefully.
Not cogito, and this needs to be scripted, but if what you _want_ to do is
undo the commit (in order to re-do it as several commits), here are the
raw git commands necessary (you could make this "git-fix-script", and then
"git fix" basically does the git equivalent of what "bk fix -C" did)
# Set up
#
. git-sh-setup-script || die "Not a git archive"
# Figure out the parent.
#
parent=$(git-rev-parse --verify HEAD^) || exit
#
# Update the index to be at that point in time and make HEAD
# point to it, but don't update the working tree contents (ie
# the changes remain in the working tree, to be re-committed).
#
git-read-tree -f -m $parent && echo $parent > .git/HEAD
NOTE! The commit still _exists_, but the HEAD reference to it is now lost.
If you want to save that as a broken branch, you can precede this with
git branch broken-branch
which means that the broken point got saved off as "broken-branch".
And if you didn't do that (or if you _did_ do that, and later end up
deciding to throw that branch away with a
rm .git/refs/heads/broken-branch
or similar) then you can get rid of the stale and unreachable objects with
a simple "git prune".
Be careful! "git prune" _will_ throw away all the objects that it can't
find references to. You might want to run "git-fsck-cache --full
--unreachable" first to get an idea of what it's going to throw away.
Linus
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: cogito - how to drop a commit
2005-08-06 22:34 cogito - how to drop a commit Sam Ravnborg
2005-08-07 0:42 ` Linus Torvalds
@ 2005-08-11 21:59 ` Petr Baudis
1 sibling, 0 replies; 3+ messages in thread
From: Petr Baudis @ 2005-08-11 21:59 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: git
Dear diary, on Sun, Aug 07, 2005 at 12:34:36AM CEST, I got a letter
where Sam Ravnborg <sam@ravnborg.org> told me that...
> I accidently commited too many files to my tree today, and now I want to
> drop the commit so I have logically separate commits.
>
> What is the right way to do this - in cogito hopefully.
>
> I do not mind to execute a few git commands, but for my daily usage I
> expect cogito to hanle everything and dropping a commit has proved
> useful for me from time to time, so I expect it be be implemented in the
> porcelain somehow.
>
> I have read the help for cg-seek - but it di not convince me to be what
> I seeked.
cg-admin-uncommit, be sure to read --help first. Linus' pruning notes
apply as well, cg-admin-uncommit won't delete it from the database
(I personally don't care about that and never pruned so far).
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
If you want the holes in your knowledge showing up try teaching
someone. -- Alan Cox
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-08-11 22:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-06 22:34 cogito - how to drop a commit Sam Ravnborg
2005-08-07 0:42 ` Linus Torvalds
2005-08-11 21:59 ` Petr Baudis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox