Home > Back-end >  Reset Git Repository for Visual Studio Solution
Reset Git Repository for Visual Studio Solution

Time:04-29

I've been using Git (with GitHub) in Visual Studio, but have not used it particularly elegantly in terms of branches, etc. I've just been maintaining the master.

That was fine during early development, but now I have a stable version 1 I want to reset my Git repository. I want to remove all old commits so that I have just the first version there, which can label/tag as V1 and then use branches correctly going forward.

How do I go about resetting / removing all old commits?

I guess I could:

  • Delete repo in GitHub
  • Delete .git folder in solution
  • Delete .gitignore file in solution
  • Delete .gitattributes file in solution
  • Restart VS
  • Create a repo

But, is there a way to just reset without deleting and re-creating the repo?

CodePudding user response:

As Franz Gleichmann is stating, there is no real point in getting rid of your history.

If you just want to clearly mark the V1 Commit you could simple make use of Git Tags

If your goal is to make the past a secret you could pull your master Squash all commits there and then push again. If your repo is public you can (and probably should) set up rules to prevent future pushes on the master

  • Related