Hi Uwe,

The Git model is more finely divided for the preparation of the commits. It 
deliberately allows you to pick apart your prepared work (you may have 
tried a few things before being ready).

Often you will want to present the changes in a neat fine grained manner 
that takes a few commits to build the overall effect, each with distinct 
commit messages.

I used it quite often with MatLab programming (which is an interpreted 
language, so lots of hack and hope), so I could pretend that I prepared the 
algorithm, then generated a neat result matrix and finally created the 
graphs.

A similar situation can happen with scripts.

So in Git, you can add 'everything', a few things, or even pick lines from 
files, for each commit, leaving the worktree (real filesystem content) 
distinct from the 'staging area/index' (equivalent to the old fashioned 
outbox on your desk-top ready to summon a clerk to 'file'[commit] it's 
contents).

It's disadvantage is that most modern folks don't have the mental model or 
imagery in their heads to know what to do, and the Git documentation is 
very poor at describing these mental model things.
e.g. 
https://www.thebalancecareers.com/thmb/XQAXfDC4f4p1YlCPBPxKoY-TVpc=/950x0/file-clerk-2164293-Final-4a26502d0c5c452684c3f13fe5f549aa.png

On Wednesday, November 20, 2019 at 1:58:25 PM UTC, UWE RICHARD OTTO BRAUER 
wrote:
>
> Hi 
>
> Am a frequent mercurial user, and an occasional git user. I usually use 
> emacs for dealing with git. 
>
> Now I could curious and wrote a small script which generates a mercurial 
> repository with 3 commits. 
> ,---- 
> | hg init 
> | echo 1 > 1 
> | hg add 
> | hg commit -m 1 
> | echo 1.1 > 1 
> | hg commit -m 1.1 
> | echo 1.2 > 1 
> | hg commit -m 1.2 
> `---- 
>
> The result is the following graph: 
> @  commit:   2:75f48e3e63ca 
> |  Branch:   default 
> |  tag:      tip 
> |  user:     Uwe Brauer <o...@mat.ucm.es <javascript:>> 
> |  Date:     Wed, 20 Nov 2019 14:53:22 +0100 
> |  Phase:    draft 
> |  summary:  1.2 
> | 
> o  commit:   1:aaf2164f69db 
> |  Branch:   default 
> |  user:     Uwe Brauer <o...@mat.ucm.es <javascript:>> 
> |  Date:     Wed, 20 Nov 2019 14:53:22 +0100 
> |  Phase:    draft 
> |  summary:  1.1 
> | 
> o  commit:   0:a5263347872e 
>    Branch:   default 
>    user:     Uwe Brauer <o...@mat.ucm.es <javascript:>> 
>    Date:     Wed, 20 Nov 2019 14:53:22 +0100 
>    Phase:    draft 
>    summary:  1 
> Now I wanted to do the same with git, 
>
> So I tried out 
>
>
> ,---- 
> | git init 
> | echo 1 > 1 
> | git add 1 
> | git commit -m 1 
> | echo 1.1 > 1 
> | git commit -m 1.1 
> | echo 1.2 > 1 
> | git commit -m 1.2 
> `---- 
>
> But this results in 
> * commit 8ed1eadffbf1ed72ebfa87fdf940db52af22e9fd (HEAD -> master) 
>   Author: Uwe Brauer <o...@mat.ucm.es <javascript:>> 
>   Date:   Wed Nov 20 14:55:09 2019 +0100 
>
>       1 
>
> so I have only ONE commit. 
>
> After looking up older emails  I found 
>
> git init 
> echo 1 > 1 
> git add 1 
> git commit -m 1 
> echo 1.1 > 1 
> git add . 
> git commit -m 1.1 
> echo 1.2 > 1 
> git add . 
> git commit -m 1.2 
>
> Resulting in 
>
>
> * commit f70fd13dd0403de3ffbb7f539e2c18e90adfc79c (HEAD -> master) 
> | Author: Uwe Brauer <o...@mat.ucm.es <javascript:>> 
> | Date:   Wed Nov 20 14:56:34 2019 +0100 
> | 
> |     1.2 
> | 
> * commit 77fbae56615d18a09e515e9da0b9a0a33829ce8b 
> | Author: Uwe Brauer <o...@mat.ucm.es <javascript:>> 
> | Date:   Wed Nov 20 14:56:34 2019 +0100 
> | 
> |     1.1 
> | 
> * commit 0b816f009a759e3f29e5dd026210951da348cdb6 
>   Author: Uwe Brauer <o...@mat.ucm.es <javascript:>> 
>   Date:   Wed Nov 20 14:56:34 2019 +0100 
>
>       1 
>
> Which is git equivalent of the mercurial repository. 
> But I am totally puzzled. What the heck 
> is git add . 
>
> Supposed to do, I added text to one file and committed, why didn't these 
> 2 last commit not work? 
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/97b9c244-ded3-4ae4-b944-3da0a504fdb9%40googlegroups.com.

Reply via email to