0 votes
1 view
in Devops and Agile by (28.4k points)

I have deleted some files and git status shows as below.

I have committed and pushed.

GitHub still shows the deleted files in the repository. How can I delete files in the GitHub repository?

# On branch master

# Changes not staged for commit:

#   (use "git add/rm <file>..." to update what will be committed)

#   (use "git checkout -- <file>..." to discard changes in working directory)

#

#   deleted:    modules/welcome/language/english/kaimonokago_lang.php

#   deleted:    modules/welcome/language/french/kaimonokago_lang.php

#   deleted:    modules/welcome/language/german/kaimonokago_lang.php

#   deleted:    modules/welcome/language/norwegian/kaimonokago_lang.php

If I use git rm, it gives the following.

usage: git rm [options] [--] <file>...

-n, --dry-run         dry run

-q, --quiet           do not list removed files

--cached              only remove from the index

-f, --force           override the up-to-date check

-r                    allow recursive removal

--ignore-unmatch      exit with a zero status even if                         nothing matched

1 Answer

0 votes
by (28.4k points)

According to the official git doc, the following command should do the magic: 

$ git add -u 

Now, you must be thinking that the question was asking for ways to "remove multiple deleted files", how add command will do, right? Well, let me explain. 

-u or --update will update the index just where it already has an entry matching <pathspec>. It will remove as well as modify index entries to match the working tree, but adds no new files. If no <pathspec> is given when -u option is used, all tracked files in the entire working tree are updated (old versions of Git used to limit the update to the current directory and its subdirectories).

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...