the log might have a record of the amend, but the first commit has actually
been replaced.
If this is undesirable, then perhaps you should create a new commit rather
than an amend.

On Thu, Sep 27, 2012 at 8:59 PM, Max Hodges <[email protected]>wrote:

> When you amend the second commit replaces the results of the first. It's
> for the occasion when you commit too early and possibly forget to add
> some files, or you mess up your commit message.
>
> On Thu, Sep 27, 2012 at 8:36 PM, Thiago Rossi <[email protected]>wrote:
>
>> Hello everybody!
>>
>> I am new to the list and this is my first topic. I am a developer who is
>> trying to make the best use of git with my projects. So far I've mainly
>> worked with local repositories. Only one of my projects has a remote
>> repository in our private server… I mean, I checkout a few projects every
>> now and then but they are “read only”…
>>
>> I have this small project and I like to keep my git repositories as clean
>> as possible. Also I try to play with git so I can learn basic and advanced
>> stuff.
>>
>> Yesterday I needed to amend a commit. As far as I know, git created a new
>> commit with the same parent as my current one. So, let's say I had:
>> A <--- B <--- C <-- D
>> After I run git commit --amend:
>> A <-- B <-- C <-- E
>>
>> If I use git log, I don't see any reference to D anymore. I know its
>> hash, and I know it's out there because it's listed if I use git reflogor git
>> checkout <D-hash> I am able to see it and check it out. If I try to use
>> rebase this commit is not listed anywhere either.
>>
>> My question is: is there any way to make D appears in the rebase or even
>> log? Why it doesn't show anywhere? I think it's been references somewhere
>> because if I run git fsck --unreachable or git prune -n -v no “lost”
>> objects are shown.
>>
>> I am just trying to understand how git works behind the scenes and this
>> got me a bit confused. I head git would discard commits that are no longer
>> referenced (such as D?!) but I couldn't undertand why it happened. I even
>> tried to merge the branch I was in and then delete the previous branch and
>> again, no “lost” objects are listed. (Aren't the branch tree and related
>> filed supposed to be unreachable or were they deleted for good? It seems
>> the list of objects haven't got smaller since I run git branch -d
>> <branch>.
>>
>> Thank you for your help!
>>
>> Thiago.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Git for human beings" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/git-users/-/5YpmpXV8SzgJ.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/git-users?hl=en.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.

Reply via email to