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 ?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Ankita
  • 11
  • 1

3 Answers3

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.

Migol
  • 8,161
  • 8
  • 47
  • 69
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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 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 Jan 19 '11 at 09:33
  • @Ankita: To import a ClearCase repo into git, see http://stackoverflow.com/questions/2546682/moving-from-clearcase-to-mercurial-your-top-tips/2546878#2546878. 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 Jan 19 '11 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 Jan 19 '11 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 Jan 19 '11 at 11:13
  • @Vonc : can GIT handle .properties & .xml file ? – Ankita Jan 19 '11 at 11:42
  • @Ankita: sure. Any text file will do. Binary too, but not in *too many* occurences, and/or not too large (as explained in http://stackoverflow.com/questions/1762413/is-git-worth-for-managing-many-files-bigger-than-500mb/1762695#1762695 ) – VonC Jan 19 '11 at 11:49
  • @Vonc : Why files are being checkout when i am switching branches. ? I havn't committed in the master branch, still files are appearing in master branch. – Ankita Jan 19 '11 at 16:27
  • @Ankita: but you say you have committed those file in your question. – VonC Jan 19 '11 at 16:29
  • @Vonc : I have committed on test_branch but not in master branch. – Ankita Jan 20 '11 at 03:21
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.

Adam Dymitruk
  • 124,556
  • 26
  • 146
  • 141