POV-Ray : Newsgroups : povray.off-topic : Git : Re: Git Server Time
29 Jul 2024 12:21:49 EDT (-0400)
  Re: Git  
From: Darren New
Date: 12 Apr 2012 12:16:41
Message: <4f86ffe9$1@news.povray.org>
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.

> 2. Move the head back one commit, but not actually delete the commit.

If nothing points to the commit, it's effectively deleted.

> 3. Move the head back one commit, but not actually delete the commit, and
> leave the changes in the staging area.

There you go.

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

It's like you're complaining "there's no one option that both deletes the 
directory element *and* removes the file's data."

>> "git gc" with the appropriate options to prune.
>
> That at least might work. (Somebody somewhere says prune only removes
> dangling branches older than 2 weeks.)

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?

> It's really quite frustrating how all
> this documentation seems to be tutorials, blog posts and SO questions. Isn't
> there a /reference manual/ somewhere??

I pointed you to it. Plus, there's the man pages, which you often complain 
you don't like because it's not tutorial enough. :-)

> If your commit is wrong, you don't /want/ to keep it. :-P

And in git, you don't. You just have the option of undeleting it for a week 
or two.

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

 > The Darcs "amend" command actually
> deletes the amended commit - you know, like what you'd expect an amendment
> to consist of. :-P

So your concern is that there's a commit out in the git data store that 
nothing points to, that will get gc'ed in a couple of weeks, and which you 
don't want to manually have to run an extra step to get rid of it before then?

> I agree it's not a good idea to go back and start changing history from 2
> years ago. But I don't see why you can't edit the last committed change.
> That just seems like a silly limitation.

You can. That's exactly what the -amend option does. It creates a new commit 
because you changed the content and it has to be given a new name.

> In a sense, Darcs /isn't/ that worried about losing commits. In Darcs, a
> branch is a repository, and so to remove changes from a branch, you have to
> delete commits. That's just how it works.

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.

>>> Then again, shouldn't you be recording those
>>> two changes in the same commit?
>>
>> 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?

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

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

> What I end up doing is just committing /everything/, because it's less
> hassle. But then if I ever need to go back, I'd have to go in big giant
> steps rather than small logical increments.

You're doing it wrong. Don't blame git for netbeans not being git.

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

> 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. It's like looking at command.com and complaining "there's no 
way to automate access to excel spreadsheets!"  Nothing you're complaining 
about is true of the git tools, only netbeans.

-- 
Darren New, San Diego CA, USA (PST)
   "Oh no! We're out of code juice!"
   "Don't panic. There's beans and filters
    in the cabinet."


Post a reply to this message

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