Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git changes to be committed files marked as deleted

Tags:

git

github

I am wanting to delete some old files on my repository due to some refactoring. Git is saying my local repo is up-to-date. However when I run git status I get the following:

# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       deleted:    app/foo1.php
#       deleted:    app/foo2.php
#       deleted:    app/foo3.php
#       deleted:    app/foo4.php
#       deleted:    app/foo5.php
#       deleted:    app/foo6.php

Prior to this I used git rm <file> to commit them.

  1. Why is this happening?
  2. Can I remove these deleted files for good? By this I mean when I run git status it shows Everything up-to-date

`

like image 864
jakehallas Avatar asked Dec 17 '25 20:12

jakehallas


1 Answers

By using git rm you actually deleted the files, but you still have to apply your changes to the local and the remote repositories.

To do so, use the following commands:

git commit -m "clean up"
git push origin master

The first one commits your changes on your local repository and make them available for the next push to the remote repository. The second command actually delivers the changes.

Of course, feel free to personalize the message for the commit. Moreover, I'm assuming that you are working on the master branch, if it's not set it correctly to the proper one.

like image 176
skypjack Avatar answered Dec 20 '25 14:12

skypjack