WEQA HUDSA WEQA HUDSA - 1 month ago 7
Git Question

is it save to remove something in git local repository and commit

Basically, I am using git lfs system. In my folder1/ I have tons of local files (some of them are in the remote repository also) which I have not committed. Now, I want to clean up some space and I kind of decided to delete the whole folder1, but i do not want to affect the remote git repo. However, I am still a contributer to the git repo.

Is it safe to just,

rm -r folder1/


and git commit my other changes later?

git commit folder2/


Thank you.

Edit: one final question:

I have one more question, suppose after, I rm -r folder1/, I want to restore the contents of folder1/ (for those in the repository), should i just do git checkout folder1/

Answer

Yes. Should be fine.

I believe this GIT simplification might be useful when doing such tasks:

enter image description here

Source here

Just as measure of precaution make diff before pulling/pushing.