This guide will provide the easiest way of removing multiple deleted files from the Git repository.
How to Remove Multiple Deleted Files in Git Repository?
To Remove the multiple deleted files from the Git repository, follow the provided steps:
- Redirect to the required Git local repository.
- Check the current working branch status.
- Utilize the “git commit -a” command.
- Verify by viewing the repository status.
Step 1: Redirect to Git Repository
At first, run the “cd” command along with the required repository path and switch to it:
Step 2: Show Repository Content
To display the content of the current working Git directory, use the following command:
Step 3: Delete Multiple Files
Then, delete the multiple files at once by executing the “rm” command:
Step 4: Check Repository Status
Next, run the below-provided command to view the status of the current working branch:
As you can see, the deleted files exist in the working area:
Step 5: Commit Staged/Unstaged Changes
Now, commit all added changes including staged/unstaged with the help of the below-stated command:
Here, when the above-given command is executed, it will open the “COMMIT_EDITMGS” file with a default text editor and ask for specifying the commit message. For instance, we have typed “Remove files”:
After specifying the commit message, all deleted files will be removed from the working area:
Step 6: Verify Removing Operation
Lastly, to ensure that all deleted files are removed from the Git working area, execute the following command:
It can be observed that the Git working area is empty, and nothing to commit:
That’s all! We have illustrated the procedure of removing multiple deleted project files from the particular Git repository.
Conclusion
To Remove the multiple deleted files from the Git repository, first, check the current working branch status. Then, execute the “git commit -a” command. Lastly, verify by viewing the repository status. This guide demonstrated the method of removing multiple deleted files from the Git repository.