Re: [git-users] Re: what is git add . ???

2019-11-21 Thread Philip Oakley

Hi Uwe,

On 21/11/2019 08:44, Uwe Brauer wrote:

"PO" == Philip Oakley  writes:

HI Philip


> Hi Uwe,

[Snip]...


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

Tanks for the detailed answer. Let me try to reword it.

   


 1. I have a registered file in git.

 2. I do a lot of changes in different   lines.

 3. So I can commit either all of them or just some parts.
using the `git add -p` (--patch) style is the part that allows you to 
(from man page):


   Interactively choose hunks of patch between the index and the work
   tree and add them to the index. This gives the user a chance to
   review the difference before adding modified contents to the index.



 4. The command git add . Tells git to use them all,
It (`.`) says use all _files_, you could also still include the `-p` 
option  to select chunks from all those changed files. Or use the `-- 
` to just select one file path (with or without `-p`)


 5. then git commit -m   "my changes" will in fact commit them all. Is this 
correct?

If you used the simple `git add .` then yes.
As noted, git gives you a lot of rope (options) to confuse yourself with 
[it is a maze of flexibility!].



If so I must say that the wording is not optimal. I thought add is for
adding files not commits.
"add" is for adding files, chunks and hunks to the staging area (a/k/a 
"Index"), in readiness for committing the Staging area/Index content 
into the repo (*)


Mercurial has the same behavior, as the one described above, only the other way 
around.


hg commit -m "my changes"
will per default commit everything. If I want to pick only some
changes I have to run

It's the change of the default expectation that can catch folk out ..

hg commit -i

Uwe

Philip
(*) a further subtlety is that "the repo" is not quite the same as "the 
object store". Often temporary items/aretfacts will be stored as objects 
in the store, and accessed via their hash value/name. The "Index" is a 
set of pointers to those artefact hash values, while "the repo" is again 
a set of linked pointers also into the object store. Those 'repo' 
pointers are from the branch refs/heads and HEAD etc.
Git does a lot of this half way, half-a-step, abstraction where the 
logical item and the physical item can easily be confused (e.g. branches 
are simply files in a nix filesystem using the nix dir/dir/file 
nomenclature as a cheat! ...


--
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/9b0f6126-7d9c-1e1b-20af-776bf517f25b%40iee.email.


Re: [git-users] Re: Git ignores global filemode setting when clonning new repositories

2019-11-21 Thread Philip Oakley

Hi Jiří,

The thing to note here is that filemode is only affecting (the 
understanding of) the executable bit.


It does *not* affect the file contents at all, so if the 'empty' 
.gitkeep file is now being shown as having gained a line then there is 
some other effect going on.


It maybe that there is some error/warning/advice message saying that the 
original file had no "end of file" (*) which is being confused as being 
that it has an extra line.


What is the actual message you see? (cut and paste?)

Philip

(*) I have seen discussions that suggest that a proper file, consisting 
of lines of text, should always have a terminating LF (line feed) as 
that is (stated as) the terminating delimiter for a line, so if it isn't 
there, there isn't a line... However some of that is just standards 
lawyering, and is ignored often (I don't even remember which standards 
might have said that - Posix?)


On 21/11/2019 08:04, Jiří Bělský wrote:

Thanks for reply,

Repos are hosted on gitlab and most devs are on linux (but not all) 
and as example, when i set filemode=true in one of the repos, it gives 
me changes in .gitkeep file saying i added a line to it (its empty file)


But again, since it does set it automatically, guess my option will be 
just to manually change it to false each time :)


čt 21. 11. 2019 v 0:30 odesílatel Philip Oakley 
 napsal:


Hi,

the clone command automatically detects if your local file system
is 'filemode' compatible.

`git help config`

search for `core.filemode`

" git-clone(1) or git-init(1) probe the filesystem to see if it
handles the executable bit correctly and this variable is
automatically set as necessary."

You may also need to consider how your team works compatibly
between OS systems. (what OS/version does the maintainer of the
repo being cloned use?)

Perhaps give an example of such a "file changed" report.


On Wednesday, November 20, 2019 at 1:48:34 PM UTC, Jiří Bělský wrote:

Hi,

im pretty sure this must be a bug, no matter what i tried, git
will always ignore filemode=false in global settings and set
filemode=true while cloning new repositories, which results in
having a lot of files tagged as changed.

Commands:
git config --get --global core.filemode
returned: false

git clone [some repository]
cd [some repository]
git config --get --local core.filemode
returned: true

i even tried setting global filemode with sudo, still same
result (:

Elementary OS 5 (based on Ubuntu 18.04)
Git version 2.24.0 (happening on 2.17.X and earlier as well)

-- 
You received this message because you are subscribed to a topic in

the Google Groups "Git for human beings" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/git-users/laea5leUejI/unsubscribe.
To unsubscribe from this group and all its topics, 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/27ce4968-a05e-4363-8e7f-81c726a332b8%40googlegroups.com

.

--
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/CAA2ZSoh30pU3j%3Dp4kr8zpFL1bxHOneLq8E6-3UnWaxq-dthDow%40mail.gmail.com 
.


--
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/34472833-111f-6ad1-1b85-225ecb2a8001%40iee.email.


Re: [git-users] Re: what is git add . ???

2019-11-21 Thread Uwe Brauer
>>> "PO" == Philip Oakley  writes:
HI Philip


   > Hi Uwe,

[Snip]...


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

Tanks for the detailed answer. Let me try to reword it.

  

1. I have a registered file in git.

2. I do a lot of changes in different   lines.

3. So I can commit either all of them or just some parts.

4. The command git add . Tells git to use them all,

5. then git commit -m   "my changes" will in fact commit them all. Is this 
correct?


If so I must say that the wording is not optimal. I thought add is for
adding files not commits.

Mercurial has the same behavior, as the one described above, only the other way 
around.


   hg commit -m "my changes"
   will per default commit everything. If I want to pick only some
   changes I have to run
   hg commit -i  

Uwe 

-- 
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/87tv6xk49w.fsf%40mat.ucm.es.


smime.p7s
Description: S/MIME cryptographic signature


Re: [git-users] Re: Git ignores global filemode setting when clonning new repositories

2019-11-21 Thread Jiří Bělský
Thanks for reply,

Repos are hosted on gitlab and most devs are on linux (but not all) and as
example, when i set filemode=true in one of the repos, it gives me changes
in .gitkeep file saying i added a line to it (its empty file)

But again, since it does set it automatically, guess my option will be just
to manually change it to false each time :)

čt 21. 11. 2019 v 0:30 odesílatel Philip Oakley 
napsal:

> Hi,
>
> the clone command *automatically *detects if your local file system is
> 'filemode' compatible.
>
> `git help config`
>
> search for `core.filemode`
>
> " git-clone(1) or git-init(1) probe the filesystem to see if it handles
> the executable bit correctly and this variable is automatically set as
> necessary."
>
> You may also need to consider how your team works compatibly between OS
> systems. (what OS/version does the maintainer of the repo being cloned use?)
>
> Perhaps give an example of such a "file changed" report.
>
>
> On Wednesday, November 20, 2019 at 1:48:34 PM UTC, Jiří Bělský wrote:
>>
>> Hi,
>>
>> im pretty sure this must be a bug, no matter what i tried, *git will
>> always ignore filemode=false in global settings and set filemode=true while
>> cloning new repositories*, which results in having a lot of files tagged
>> as changed.
>>
>> Commands:
>> *git config --get --global core.filemode*
>> returned: *false*
>>
>> *git clone [some repository]*
>> *cd [some repository]*
>>
>> *git config --get --local core.filemode*
>> returned:* true*
>>
>> i even tried setting global filemode with sudo, still same result (:
>>
>> Elementary OS 5 (based on Ubuntu 18.04)
>> Git version 2.24.0 (happening on 2.17.X and earlier as well)
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Git for human beings" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/git-users/laea5leUejI/unsubscribe.
> To unsubscribe from this group and all its topics, 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/27ce4968-a05e-4363-8e7f-81c726a332b8%40googlegroups.com
> 
> .
>

-- 
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/CAA2ZSoh30pU3j%3Dp4kr8zpFL1bxHOneLq8E6-3UnWaxq-dthDow%40mail.gmail.com.