Home > Back-end >  What to do with an unsettled Git after moving workspace?
What to do with an unsettled Git after moving workspace?

Time:07-02

I am new to Git & started to use it after I watched a video on YouTube for newcomers. The workspace I was using was on the D: drive on the Windows notebook, and I moved it to another location on OneDrive. Then, I zipped the project folder and unzipped the last zip file that I created on the D: drive. I got some errors (similar to those below) and removed this directory, unzipping the moved project file. This unsettled Git.

In the new directory, I get the following message after the status command:

$ git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
  (commit or discard the untracked or modified content in submodules)
        modified:   AstroCoordinates (modified content, untracked content)

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        .metadata/
  
  no changes added to commit (use "git add" and/or "git commit -a")

What I need is

  1. either some touches that make Git clear that the only project called AstroCoordinates is to be added without any "inappropriate" messages, or, as I am the only developer of the project, to
  2. "reset" git so that it starts from the "beginning", i.e. to make changes to the workspace such that Git does not "understand" that it was used in this directory.

What I cannot accept is that project files are deleted. My .gitignore file says to ignore /bin and .metadata only.

CodePudding user response:

and I moved it to another location on OneDrive

That's the problem. Git doesn't work correctly when you put a repository / working tree on a shared volume of this sort (OneDrive, DropBox, etc.), for the very reason you are experiencing: the shared volume mechanism itself makes alterations to the working tree, and Git picks up on those and thinks that you made those alterations.

But in any case, as has been pointed out in a comment, there is no need to keep the repository on a shared volume, because Git is already a distributed system by its very nature.

  •  Tags:  
  • git
  • Related