简体   繁体   中英

How do I deal with the array out of bounds exception when creating a new git branch from a past commit in Visual Studio?

Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.

This is what I get in the Team Explorer tab when I try to create a new branch to one of the previous commits. I've had this error happen in the past, and updating to the most recent version of VS 2017 (15.9.7) just now made no difference. In the past the only way I've managed to get around this problem is by branching out to some other commit, but now this really hit me where it hurts.

Using git checkout from the command line worked for me.

More specifically, git checkout <commit> -b temp where <commit> is the commit id. What this did is create a branch named temp similarly to how it would be done using the IDE.

I have no idea why this error occurs for me, but while looking at similar issues I noticed that people managed to get around using git commands from the command line. It worked fine enough here.

It's due to overload of commits cache in local, since it's specific to Visual Studio

  • Option 1 : use git bash git checkout
  • Option 2 : Take a local repo backup, delete it and clone it one more time

I had this error and I made the following steps: Go to: Visual Studio -> Team Explorer -> Branches Step 1: Remove the local Branches that you do not need any more Step 2: on each remaining local Branches I right click and select Reset -> Delete changes (hard)

Probably not need existing changes once you start to work on another branch.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM