Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3980930
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:20:57+00:00 2026-05-20T05:20:57+00:00

I have not decided if I like the following behavior regarding files / folders

  • 0

I have not decided if I like the following behavior regarding files / folders that are not under version control.

In particular, it seems strange that un-versioned files seem to follow you when you checkout different branches. It seems like said files should only exist in the branch they were created in.

Can someone please help me understand why / if this is desirable behavior?

For example:

shopkins@shax:~/tmp/test$ ls
hello.txt
shopkins@shax:~/tmp/test$ git branch  
-
* master
my_branch
shopkins@shax:~/tmp/test$ 
shopkins@shax:~/tmp/test$ git checkout my_branch 
Switched to branch 'my_branch'
shopkins@shax:~/tmp/test$ mkdir adir
shopkins@shax:~/tmp/test$ touch adir/my_branch.txt
shopkins@shax:~/tmp/test$ git add adir/
shopkins@shax:~/tmp/test$ git commit -a -m "added adir with my_branch.txt"
[my_branch d36964c] added adir with my_branch.txt
0 files changed, 0 insertions(+), 0 deletions(-)
shopkins@shax:~/tmp/test$ git checkout my_branch
Switched to branch 'my_branch'
shopkins@shax:~/tmp/test$ tree
.
|-- adir
|   |-- my_branch.txt
|   `-- orphan.txt
`-- hello.txt

1 directory, 3 files

create mode 100644 adir/my_branch.txt
shopkins@shax:~/tmp/test$ touch adir/orphan.txt
shopkins@shax:~/tmp/test$ git checkout master
Switched to branch 'master'
shopkins@shax:~/tmp/test$ ls
adir  hello.txt
shopkins@shax:~/tmp/test$ tree
.
|-- adir
|   `-- orphan.txt
`-- hello.txt

1 directory, 2 files

EDIT
As it turns out, nothing was changed in the files between the branches in the following first edit. Thanks for the help everyone!

EDIT
It seems that git does not write modification of versioned files when checkouts occur. In the following example, another.txt is not under version control:

shopkins@shax:~/tmp/test$ ls -l
total 4
drwxr-xr-x 2 shopkins shopkins 4096 2011-02-21 21:49 adir
-rw-r--r-- 1 shopkins shopkins    0 2011-02-21 21:47 another.txt
-rw-r--r-- 1 shopkins shopkins    0 2011-02-21 21:49 hello.txt
shopkins@shax:~/tmp/test$ git checkout my_branch
Switched to branch 'my_branch'
shopkins@shax:~/tmp/test$ ls -l
total 4
drwxr-xr-x 2 shopkins shopkins 4096 2011-02-21 21:49 adir
-rw-r--r-- 1 shopkins shopkins    0 2011-02-21 21:47 another.txt
-rw-r--r-- 1 shopkins shopkins    0 2011-02-21 21:49 hello.txt
shopkins@shax:~/tmp/test$ 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T05:20:58+00:00Added an answer on May 20, 2026 at 5:20 am

    Git doesn’t even know that the un-versioned files exist. Technically they aren’t even part of the repository. That is why they are called “un-versioned files.” Git does not modify, delete, store, or keep track of any file unless it is told to.

    The classic situation where this is desirable is if your software generates temporary files as part of its build process, or if the compiled executables are left in the same directory as the source code. Obviously, if someone is cloning your repository so they can download your software from you, you would want all those files to be “left behind.” But more importantly, you would not want them cluttering up the version history. It doesn’t matter when these files change, only when the source code changes. So seeing diffs of these files with every commit will only make it harder to find the information you actually want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have the following Java interface that I may not modify: public
I have a table that looks like the following (simplified): <table id=product_table> <tbody> <tr>
My company has decided to develop ebook DRM platform. The platform does not have
I have not had to do something like this in the past and am
I have to maintain some legacy codes,parts of it look like the following: /*
For example, if ı have lines like this: $this->db->where(blabla,$blala); And following this line, I
I have the following function that I wrote couple of years ago. It takes
I have a bunch of content files for my iPhone app that I generate
I have a try-catch block that iterates over a set of records like this:
I have a GWT app (generated by roo) that I have decided to secure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.