Accidentally deleted git ignored file in Flutter project - flutter

I accidentally deleted a file that was in .gitignore, let's call the file abc. Since the file was an important asset and was located in pubspec.yaml under the "asset" entry, every time the workflow starts it fails when it runs "flutter analyze". Any suggestions?

If the file is git-ignored, git does not track it (unless it was forcibly added, but then it's not really ignored even though it appears in the .gitignore file). Unless you have some other filesystem backup, I fear you're out of luck.

Related

.gitignore file not ignoring .env.local or any other supposed private file

I encountered this error because I once mistakenly committed .env.local before adding it to .gitignore. The answer to it below.
If you're facing something similar and you use the Git GUI in VSCode, just follow these steps:
Open your .env.local file or any file that's having this issue, copy the content to clipboard, and delete the file entirely.
Open your .gitignore file and delete the line that removes that file.
Commit your changes (not necessarily publish).
Now create a new .env.local file (or the file you deleted earlier in your case.)
Switch to your Source Control tab (where you see staged files), right click on this newly created file and add it to .gitignore
Now, it will be ignored for real.

Should I add .parcel-cache in .gitignore? [duplicate]

What is the .cache folder in parcel-bundler? Is it necessary to push the .cache folder to Github ?
The .cache folder (or .parcel-cache in parcel v2) stores information about your project when parcel builds it, so that when it rebuilds, it doesn't have to re-parse and re-analyze everything from scratch. It's a key reason why parcel can be so fast in development mode. I think committing it to git would be a bad idea - it would add a large number of (unnecessary) changes to your commit history, and it could easily get out-of-sync with the code that generated it.
From this article:
Be sure to add .cache and dist to your .gitignore file to prevent
committing these folders to Git. The .cache folder is used by Parcel
as a temporary cache directory when building your app for development
and production.
A slight update on this answer, although it is practically the same response, would be that the command you now need to enter for parcel#^2.0.0-beta.1 is:
.parcel-cache
Add this to your .gitignore file and all the Blobs will be removed from your Untracked listed of files when you hit git status again.
Thank you for helping me resolve this issue!
no it is not necessary to add parcel-cache in git. one should add parcel-cache in git-ignore because parcel-cache is the space taken by parcel during production building its a binary files .This can be made again after deleting cache with a command npm run build

What does the xcschememanagement.plist file do in XCode? And can I ignore it with git?

Due to the poor documentation of XCodes files that manage your project under the hood, I cannot understand the purpose of the xcschememanagement.plist file, which is causing me a lot of problems.
Can anyone explain this file's purpose, and how we should be treating it with git source control?
Here is the full path to the file PROJECT_ROOT/xcuserdata/alecmather.xcuserdatad/xcschemes/xcschememanagement.plist
My problem with git and this file:
Let's say I start on branch_1.
I make some commits to this branch.
Then I switch to branch_2.
I make some commits there, and decide to run my project.
After I'm done, I stop running my project and switch back to branch_1.
I run my project there, and close it.
I attempt to switch back to branch_2 but am stopped by git saying that I have uncommitted changes in the current directory. But I did nothing but run my project.
So I'm assuming that this file holds some things that can get changed around when building/running your project? But this gets really tedious when switching between branches all the time. Do I commit the changes to that file from this scenario? Can I safely just discard the changes?
Yes, you can safely ignore the whole xcuserdata folder. All premade .gitignore files I've seen so far for Xcode projects do so, including https://github.com/github/gitignore/blob/master/Global/Xcode.gitignore

Git add is ignoring certain files even when .gitignore does not exist

I am facing a rather strange issue with my git working folders. Here's the summary:
I previously had a local git repo with a .gitignore file that ignored certain files/folders.
I deleted the repo (.git folder) and also the .gitignore file
Then I initialized a new one with git init in the same folder. Now when I do a "git add .", the previous ignore pattern is retained for some reason.
Even stranger,this happens with any new project following the same folder structure no matter where I place the project on my computer.
I tried deleting and recreating the files multiple times. I even created a new .gitignore file with a different pattern. It does not seem to have an effect except when it is set to ignore everything (with just * in the file)
My guess is that the .gitignore pattern I deleted is somewhere saved that I dont know the location of. If anyone has faced a similar issue or know what I could be missing, I'd love to know.
I am still new to git. Sorry if this is something very obvious that I have missed out on.
UPDATE:
I still have not found the reason for this behaviour but managed to reset everything by doing 'git add --force .' in the directory and then deleting the repo. Now I initialized a new repo that works as expected.

can't commit code after renaming a file

What I did:
renamed a file
tried to commit
cvs fails with error message
file should be removed and is still there (or back again)
What is the problem and how do I solve it so that I can commit?
Additional information:
I'm using Eclipse with the CVS plugin.
doing an ls in the directory where the file was shows that it is not there
All the other Google hits for this problem (including this question) seem to be asking what to do when a file has been removed with cvs, and then restored outside of cvs' scope. My problem is different: I just need to rename a file.
It means that the file was flagged for deletion by CVS but then appeared again. Renaming for CVS is just a deletion of the file with old name and adding the file with new name. The file must be appeared again with its old name.
You can do 2 things:
1) If you don't need this file then just delete it. (Use cvs -n update command to find its name.) Then you will be able to commit.
1) if you need this file to stay, go to the .CVS subfolder of the folder where the file is located and edit Entries file. Find a line with your file and delete it. Then rename you file (give it a temporary name), call cvs update, rename your file back overriding the new one appeared after cvs update.