git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Tracking the untracked

From
Geoff Russell <geoffrey.russell@gmail.com>
Date
May 7, 2009, 07:58 UTC
Message-ID
<93c3eada0905070058g7f619a56jfb9b49f02bb92f9b@mail.gmail.com>
In-Reply-To
<200905061522.56981.trast@student.ethz.ch>
On 5/6/09, Thomas Rast <trast@student.ethz.ch> wrote:
Show 49 quoted lines
> Geoff Russell wrote:
>  > Bug or feature? I don't know.
>
>
> Feature.
>
>
>  > On the master branch I have some untracked files e.g., object modules,
>  > executables.
>  >
>  > I create a branch B1 and add+commit the untracked files.
>  >
>  > When I switch back to the master (git checkout master), the untracked
>  > files are no longer where I left them.
>
> [...]
>
> > One solution would be to have a class of files that is "unversioned
>  > but tracked".
>
>
> Note that "versioned" and "tracked" mean the same thing in Git --
>  both denote the class of files it cares about.
>
>  Your build products became tracked (w.r.t. the then-state of the
>  repository, on branch B1) the second you added them to the index with
>  'git add'.  Git then cares about them, and among many other things
>  will look at them whenever you change branches.  Since they're not
>  present in the target branch 'master', they are removed from the work
>  tree.
>
>
>  > Basically, I'm trying to find a way of having a huge bunch of stuff in
>  > my repository and
>  > tracked, but which doesn't get pushed to the central program repository .. which
>  > has always just been source for us .. I figured I could stick it on a
>  > branch which doesn't get pushed.
>  > But that doesn't work for the reason mentioned.
>
>
> Most people just put their build products in .gitignore so that they
>  stop showing up under "untracked files" in 'git status'.  (They'll
>  still be untracked!)
>
>  Of course this means the object files for source that actually changed
>  between the branches have to be rebuilt.  However, Git takes great
>  care to not touch any source files that are the same, so that the
>  builds are usually quite fast even after a branch switch.
>

Ok, its clearly a policy choice. But suppose I have an untracked file and I do "git some-command" then I don't expect git to touch what it doesn't know about. I.e., "git add x" shouldn't delete the untracked file y. That seems sensible. But now "git checkout branch" behaves quite differently in just deleting stuff that it doesn't own (i.e., is untracked).

Anyway, I'll rethink.

Cheers, Geoff.

Show 6 quoted lines
>
>  --
>  Thomas Rast
>  trast@{inf,student}.ethz.ch
>
>
-- 
6 Fifth Ave,
St Morris, S.A. 5068
Australia
Ph: 041 8805 184 / 08 8332 5069
Previous: Thomas RastNext: Jakub Narebski
Message 4 of 7 in “Tracking the untracked”
  1. Geoff RussellMay 6, 2009
  2. Johannes SchindelinMay 6, 2009
  3. Thomas RastMay 6, 2009
  4. Geoff RussellMay 7, 2009
  5. Jakub NarebskiMay 7, 2009
  6. Thomas RastMay 7, 2009
  7. Geoff RussellMay 7, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.