POV-Ray : Newsgroups : povray.off-topic : Git : Re: Git Server Time
29 Jul 2024 14:14:30 EDT (-0400)
  Re: Git  
From: Invisible
Date: 13 Apr 2012 04:36:44
Message: <4f87e59c$1@news.povray.org>
On 12/04/2012 05:16 PM, Darren New wrote:
> On 4/11/2012 2:23, Invisible wrote:
>> 1. Delete the last commit /and the changes it contained/. (Why would you
>> ever want to do this?)
>
> Changes aren't stored in git, so naturally deleting a commit deletes the
> changes. Delete the commit without deleting the changes in your working
> copy, and then create a new commit based on those changes.

That's what I'm saying - option #1 deletes the commit AND REVERTS THE 
WORKING COPY. I can't fathom why you'd want to revert your working copy. 
That means that anything that was in the commit is now /gone forever/. 
Which is no help if you actually want to redo the commit.

>> 2. Move the head back one commit, but not actually delete the commit.
>
> If nothing points to the commit, it's effectively deleted.

Except that every single time I look at the history tree, this dangling 
commit shows up, with a description which doesn't match what's actually 
in it. Which is the problem I was trying to sort out in the first place.

>> Nowhere is there an option that says "perform the exact inverse of what I
>> just told you to do".
>
> I'm not sure what you're trying to say. #3 does what you want, if you
> follow it up with "delete commits that no heads or other commits point to."

> That would be the "appropriate options" to modify. Tell it to use zero
> days.
>
> Why are you hell-bent on getting rid of that commit? Do you zero out all
> the sectors of your hard drive every time you delete a file?

I made a trivial mistake. It just surprises me that it's this long and 
complex to undo such a simple and common mistake.

[Although it would be much /less/ common if NetBeans wasn't being so 
retarded. :-P ]

>> But seriously, if
>> I want to change something, why shouldn't I be able to change it? Git
>> has an
>> "amend" command, it's just that it doesn't /amend/ the commit - it
>> creates a
>> new one, but leaves the old one in place.
>
> Files are named after their contents. If you want to make a change, by
> definition, you have to give it a new name.

Darcs also names changes after their hash. The Darcs amend command also 
changes the commit name. It's just that Darcs automatically deletes the 
old, incorrect commit, and keeps only the new, corrected one. Isn't that 
what "amending" something would be expected to mean?

>> In a sense, Darcs /isn't/ that worried about losing commits.
>
> Right. And you can remove commits from git by deleting them. You're just
> unhappy that git asks you to take two steps (or wait a while) to remove
> a commit irrevocably.

It would just be nice if there was a way to actually mark unwanted 
commits as "deleted", rather than them still showing up as part of the 
valid history of the project.

>>> Heavens no!
>>
>> You shouldn't group related changes together, no?
>
> No. You should group the minimum number of changes that gives you a
> consistent state. What if you find the implementation of the routine is
> right, but the code calling it is all screwed up?

Heck, I generally don't even worry about consistent states. Not, as in, 
whether the project is runnable. I work in whole logical changes. Like, 
I group all the changes to do with X together, all the changes to do 
with Y together, and so on. It might be that you need to apply X, Y and 
Z to get back to a runnable state again. But it's more that if I'm in 
the middle of editing and I screw it up, I want to be able to back out 
just the thing I'm trying to edit, not the whole of X, Y and Z and start 
over.

>> That's the other thing. With Darcs, I edit some files for a while, and
>> then
>> say "commit this". It shows me each and every change, and asks if I
>> want to
>> include that. And even though I've only got one set of changed files,
>> I can
>> syphon off the changes and ground them into several logically separate
>> commits. Git can't seem to do that.
>
> Sure it can. That's the coolest thing about git. Indeed, that's exactly
> the point of the staging area being different from the working
> directory. You copy the changes you want to commit into the staging
> area, then commit it.

No. This still requires you to manually edit the files to the right 
point. Like, if I edit a file and change X, Y and Z, then when I decide 
I want to commit it, I have to go through the file, undo Y and Z (but 
not forget how to redo them), commit the file with just X changed, then 
redo Y, and commit that, and finally redo Z and commit that. The fact 
that there are two copies of the file is no help at all here. It's not 
like you can edit the staging copy.

> What you mean is "netbeans interface to git doesn't do that."

Actually, NetBeans seems to have its own internal history tracking, so 
in a sense, it /can/. You can find the lines you changed, hit "revert 
change", do your commit, and then jab Undo a few times to redo the 
changes. It's klunky and hard, but it's better than just Git by itself.

> You're doing it wrong.

Or rather, "Git isn't really supporting my workflow".

> Don't blame git for netbeans not being git.

Oh, /some/ of the problems I've had are definitely to do with NetBeans 
being lame. I won't blame Git for that.

>> How about /not/ having to make a commit that records changes that I've
>> already committed? :-P
>
> You never made the change before where both pieces of code are in the
> same file.

I meant more that of you change one file on one branch, and an unrelated 
file on another branch, to get those changes together, you need to 
record a new commit. Even through there's no new changes, another than 
both files being in the same branch now.

>> Actually, it would probably be easier if NetBeans would actually show me,
>> you know, /a history/, so I can see what's actually /happening/,
>> rather than
>> just having to try to guess from the hashes which branches contain
>> what...
>
> Again, you're looking at a bad interface to git, and then complaining
> git doesn't work.

No. With /this/ point, I'm complaining squarely about NetBeans. If you 
install the actual Git binary, it comes with some passable tools for 
visualising what's actually going on. It's not pretty, but it works.

(I'm still trying to figure out how to get gitk to resize so I can see 
the whole history tree. There doesn't seem to be a way to enlarge the 
tiny tree view at the top and shrink the enormous commit viewer at the 
bottom which I don't care about...)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.