-1
  1. I did check the answers on SO about "won't add files", tried in my case, they didn't work.

So, here is what I have. Project, 2 branches, master and 10_8.

Currently I'm in master.

When I try to make git checkout 10_8 I'm getting the error error: The following untracked working tree files would be overwritten by checkout, ...., so I do git add -A . and then git commit -m "message" which actually do nothing because if I try to checkout the 10_8 branch I get the same error message.

The remote repository is located on BitBucker, and if I check the source, the folder with files that won't be added has a different icon than regular folder, it looks like this for master branch.

enter image description here

How to solve this issue?

Thx

Eugen
  • 2,934
  • 2
  • 26
  • 47
  • For those who are down-voting, say at least what's wrong I'll keep digging into that direction. – Eugen Dec 24 '14 at 18:14
  • what does 'git status' say? And do you have a .gitignore file? The message says that some file on 10_8 will clash with an existing file on master (who's name is being given!) try using `gitk -10 10_8 &` to visualise what's on the current 10_8 (try the tree view for file by file details) – Philip Oakley Dec 24 '14 at 18:23
  • git status says 'nothing to commit, working directory clean'. There is no '.gitignore' file. – Eugen Dec 24 '14 at 18:26
  • does git status give you on which branch you are, or it says that you are detached!? – mamdouh alramadan Dec 24 '14 at 18:28
  • git status says 'On branch master' – Eugen Dec 24 '14 at 18:30
  • That's a [submodule](http://git-scm.com/docs/git-submodule). I'll find a duplicate question and link to it in a moment. – ChrisGPT was on strike Dec 24 '14 at 18:31
  • possible duplicate of [What is this grey git icon?](http://stackoverflow.com/questions/20412396/what-is-this-grey-git-icon) – ChrisGPT was on strike Dec 24 '14 at 18:31
  • when I run the command 'git submodule update --init' it says 'No submodules mapping found in .gotmodules for path ' – Eugen Dec 24 '14 at 18:34
  • Since you have recently committed to 'master' and a `git status` shows the working directory is clean, why not **force** the checkout of the branch? `git checkout -f 10_8` – Thom Parkin Dec 24 '14 at 18:52
  • @Eugen, it sounds like you might have done this accidentally. Do you *want* that directory to be a submodule? (This is usually done for libraries, where you need one Git repository inside another.) – ChrisGPT was on strike Dec 24 '14 at 18:58
  • @Chris - I received this project from a previous developer and it was this way already, I would rather have it as a regular folder not sub-module as I don't see it as a library. – Eugen Dec 24 '14 at 19:15

1 Answers1

0

It sounds like you've got an unwanted (and partly broken) submodule. Submodules are often used for libraries, or other situations where you need to have one repository inside another.

Because you say

I would rather have it as a regular folder not sub-module as I don't see it as a library

the easiest solution is probably to find the inner .git directory and remove it:

  1. cd OrthoSensorLu (change into the subdirectory; I can't see its full name in the screenshot)
  2. git status, git log, etc. to make sure that there isn't any history in this inner project that you need to keep
  3. Assuming you still want to proceed, rm -rf .git

Alternatively you can remove the OrthoSensorLu.../.git/ directory using whatever file manager is used on your operating system.

After you do this, you should be able to add and commit the directory's contents to your main repository just like any other directory.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • well, the funny think is, I don't have a '.git' folder under that directory. – Eugen Dec 24 '14 at 23:55
  • I'll accept your answer as it is partially correct. I followed these instructions http://stackoverflow.com/questions/1759587/un-submodule-a-git-submodule and I got what I needed. Thx! – Eugen Dec 25 '14 at 00:00