Here are the steps that I have followed:
- Created a repository
- added a file to the
master
branch. - created a branch called
test_branch
. - added close to 30k files in the
test_branch
& committed. - 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 intest_branch
in mymaster
branch as well.
Why I am getting this e开发者_运维百科rror, and how to overcome it ?
- 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.
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
.
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.
精彩评论