# No Checkout / Read Only config Flag

3 messages from 2019-11-07 to 2019-11-08. Participants: Ingo Wolf, Philip Oakley, Konstantin Khomoutov.
Thread: https://gitlist.dev/t/52213

## Ingo Wolf, 2019-11-07 21:34

Subject: No Checkout / Read Only config Flag
Message-ID: <f3378b7b-c745-58db-55ed-c2c2a6818734@gmx.de>
URL: https://gitlist.dev/e/f3378b7b-c745-58db-55ed-c2c2a6818734%40gmx.de

```
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, 2019-11-08 16:08

Subject: Re: No Checkout / Read Only config Flag
Message-ID: <baf800ba-d92c-74be-d590-56f3bb4c6c44@iee.email>
URL: https://gitlist.dev/e/baf800ba-d92c-74be-d590-56f3bb4c6c44%40iee.email
In-Reply-To: <f3378b7b-c745-58db-55ed-c2c2a6818734@gmx.de>

```
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, 2019-11-08 15:50

Subject: Re: No Checkout / Read Only config Flag
Message-ID: <20191108155037.rru2glzbdw4npnte@carbon>
URL: https://gitlist.dev/e/20191108155037.rru2glzbdw4npnte%40carbon
In-Reply-To: <f3378b7b-c745-58db-55ed-c2c2a6818734@gmx.de>

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


```
