threads / discuss / 52213

No Checkout / Read Only config Flag

Subject: No Checkout / Read Only config Flag

## tl;dr

3 messages between Nov 7, 2019 and Nov 8, 2019.

replies: 2people: 3as markdown or json

Ingo Wolf· Nov 7, 2019, 21:34 UTC · lore
Hi,
is there a readonly / no checkout flag in the git configs?

I use Git to trace / Backup some worktrees and would like to prevent changing them accidentally with git.

Philip Oakley· Nov 8, 2019, 16:08 UTC · re: Ingo Wolf · lore

Re: No Checkout / Read Only config Flag

On 07/11/2019 21:34, Ingo Wolf wrote:
> Hi,
>
> is there a readonly / no checkout flag in the git configs?
>

Not that I'm aware of, but the use-case isn't clear, and is perhaps contrary to actually having a version management system

> I use Git to trace / Backup some worktrees and would like to prevent
> changing them accidentally with git.
>

How would such 'accidents' happen? What's the size of the worktree and how do you do such an accidental commit?

I could see that if you are changing hundreds of files within a commit, and only one or two files need preserved, then did a `git add -A` you would include any changes to those one or two special files, which needed special attention.

This feels similar but not quite the same as previous discussions about 'precious' files (the latter commonly being untracked/ignored, but shouldn't be removed/cleaned).

Technology won't solve the human error modes..., though a clear use case can help.

-- 
Philip
Konstantin Khomoutov· Nov 8, 2019, 15:50 UTC · re: Ingo Wolf · lore

Re: No Checkout / Read Only config Flag

On Thu, Nov 07, 2019 at 10:34:32PM +0100, Ingo Wolf wrote:
> is there a readonly / no checkout flag in the git configs?
> 
> I use Git to trace / Backup some worktrees and would like to prevent
> changing them accidentally with git.

There's so-called "sparse checkout" feature in Git: it allows the user to designate parts of the work tree hierarchy as uninteresting, and Git won't touch them unless told otherwise.

Please refer to the section "SPARSE CHECKOUT" in the git-read-tree manual page (run `git help read-tree`).

To cite the git-checkout manual page:
| --ignore-skip-worktree-bits
|   In sparse checkout mode, git checkout -- <paths> would update only
|   entries matched by <paths> and sparse patterns in
|   $GIT_DIR/info/sparse-checkout. This option ignores the sparse patterns
|   and adds back any files in <paths>.

← back to recent threads