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

  • SEARCH
  • Home
  • 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 8259525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:53:07+00:00 2026-06-08T02:53:07+00:00

I have a very simple git repository that I’ve been using to learn git.

  • 0

I have a very simple git repository that I’ve been using to learn git. I have two branches in addition to master; javafx, netty. I created a new project module within each branch. For the netty branch, the project layout looks like this:

sandbox
  netty

For the javafx branch, the project layout looks like this:

sandbox
  javafx

Whenever I used to switch between branches, I would still have the directory from the other branch in my working directory. I switched branches a lot and it the extra directory was never deleted. I decided I should learn to clean up my working directory properly and, while on the netty branch, I ran:

git clean -fd

It did exactly what I expected, but now Git’s checkout behavior seems different. When I switch from the netty branch to the javafx branch it’s just like it used to be; the extra netty directory stays in my working directory. However, now when I switch from the javafx branch to the netty branch, the javafx directory gets deleted / cleaned automatically.

However, if I clone the repo on another machine it still works the way it used to; all the untracked files get left in my working directory. Does git clean -fd have some type of permanent effect?

Edit: After some more playing, I have realized this has something to do with my IDE (IntelliJ IDEA). Git can’t seem to delete the directories of active project modules when I check out another branch that doesn’t include those project modules.

For example, if I’m on my netty branch and checkout the javafx branch, Git can’t seem to remove the netty directory. However, if I re-check out the netty branch without regenerating my IDEA project, Git has no problem removing the javafx directory.

After my IDE prevents those directories from being deleted once, they hang around forever as untracked files in my local repo until I run git clean -fd. Even closing my IDE and switching between branches doesn’t change anything.

If I clone the repository and check out branches without ever starting my IDE, everything works like I would expect. The unrelated directories are removed when I check out a new branch.

How does Git react if another process prevents it from removing an unneeded file when a new branch is checked out?

  • 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-06-08T02:53:08+00:00Added an answer on June 8, 2026 at 2:53 am

    From the man page of git-help

    Cleans the working tree by recursively removing files that are not
    under version control, starting from the current directory.

    Normally, only files unknown to git are removed, but if the -x option is specified, ignored files are also removed. This can, for example, be useful to remove all build products.

    If any optional … arguments are given, only those paths are affected.

    In essence git clean -fd removes all untracked files and directories in your local copy except for the files ignored in .gitignore.

    My suspicion is you have started tracking those generated files by mistake in one of those branches.

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

Sidebar

Related Questions

I have a very simple fxml file, with a checkbox: ... <AnchorPane id=AnchorPane xmlns:fx=http://javafx.com/fxml
I have a very simple script that creates a user: <?php include 'mysqlserver.php'; session_start();
I am currently using git for a project that has two participants (me and
I have a git repository set up that looks something like this: PROD /
i have very simple problem. I need to create model, that represent element of
I have a remote git repository where I have a tag (tag-1) that is
My routine on git has always been very simple: git add -A git commit
I have very simple piece of code. The goal is when i input four-digit
I have very simple OpenGL ES example similar to Hehe's example : http://nehe.gamedev.net/tutorial/ios_lesson_02__first_triangle/50001/ As
I have very simple window where I have 2 buttons - one for cancel,

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.