1

Here are the steps that I have followed:

  1. Created a repository
  2. added a file to the master branch.
  3. created a branch called test_branch.
  4. added close to 30k files in the test_branch & committed.
  5. now when I try to switch to master branch. It says "checking out files: 83% (24967/30002)", and now I have all the files which I have committed in test_branch in my master branch as well.

Why I am getting this error, and how to overcome it ?

2
  • what does git status say before step 5? It might help if you copy the whole output of your prompt.
    – Gauthier
    Commented Jan 19, 2011 at 10:41
  • Nothing to commit. working directory is clean
    – Ankita
    Commented Jan 20, 2011 at 6:20

3 Answers 3

1
  1. created a branch called test_branch

How did you make it? Have you checked if you have checked it out? There are two commands to do it - git branch will NOT checkout it and git checkout -b will.

1
  • ya i created a branch using git branch test_branch & then git checkout test_branch.
    – Ankita
    Commented Jan 19, 2011 at 9:32
0

For such large volume of files in one branch, as opposed to the other, it might be better to clone the repository (which should reference by default the master branch), while leaving your first repo on the test_branch.

9
  • do you mean to say if i have 10 branches in my clearcase vob & if i wish to replicate the same in GIT I need to create 10 repositories?
    – Ankita
    Commented Jan 19, 2011 at 9:33
  • @Ankita: To import a ClearCase repo into git, see stackoverflow.com/questions/2546682/…. You need to reorganize your data and not import everything in one repo. My answer alludes to one repo cloned multiple times, but again, for an export from a CVCS (Centralized VCS) like ClearCase, you need to export parts of the ClearCase repo into several Git repos.
    – VonC
    Commented Jan 19, 2011 at 10:04
  • @ VonC : I tried a very simple thing. I have set a view & what ever is there in that view, I have copied that in one of the branches of GIT repo. When I switch branches, I am getting this error. Can't git handle large number of file ?
    – Ankita
    Commented Jan 19, 2011 at 10:12
  • @Ankita: Git can handle large number of files, but not all types of files (large number of binaries for example would be problematic)
    – VonC
    Commented Jan 19, 2011 at 11:13
  • @Vonc : can GIT handle .properties & .xml file ?
    – Ankita
    Commented Jan 19, 2011 at 11:42
0

If you want to keep the working dir unchanged, use git reset --soft <tree-ish>. To make branches point wherever you want without having to check them out, use git update-ref refs/heads/branch_name <tree-ish> where tree-ish could be head^, master^2~3, other_branch, other_branch@{"2 days ago"}, etc.

Hope this helps.

Not the answer you're looking for? Browse other questions tagged or ask your own question.