How to Commit Deleted Files from Local Project?

Asked

Viewed 1,712 times

5

DESCRIPTION:
I have a relatively common problem, but it slows me down a lot in the project, so let’s go. Suppose I have a project with the examples directories: css, dist, src, js, fonts, and some files at the root like index.html, readme.Md, config.Rd and any other files at last.

Now suppose in my directory "src / img" i have several images that have already been added, comitadas all this locally even, no need to play to the repository.

PROBLEM:
Now for any reason unimportant I changed all the files in my directory "src / img" and when I use command git status he returns me a list of new files and deleted files, then I execute the command git add . adding all new files to Stage sure of what I want to do I make the changes git commit -m "Atualizada as imagens do projeto", ready "perfect".

But if I run again git status git returns me the list with ALL those files that no longer exist, and I want them to be deleted from my commited project there in git dependencies, but suppose there are more than 200 and they all have different names and different extensions and are on the same path as my new images, I can’t just run git rm src/img/*.jpg or git rm src/img/*.png because my new images will be deleted together.

QUESTION:
How can I make it so that I can delete all the old files, regardless of the extension, that are in my project on the git dependencies there, but that no longer exist in my local project, with a command just so I don’t have to run git rm src/img/exemplo01.png, git rm src/img/exemplo02.png ...?

  • 1

    Have you tested $ git add --all?

2 answers

9


I use $ git add --all, equivalent to $ git add -A.

The difference in the $ git add . is that the --all also refreshes deleted files. O add . does no action with removed files.

  • 2

    Pretty obvious, but I didn’t know, thank you

2

Browser other questions tagged

You are not signed in. Login or sign up in order to post.