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.
deleted
files for good? By this I mean when I run git status
it shows Everything up-to-date
`
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.
You need to git commit
after using git rm
. The git rm {filename}
command only removes the files in the working tree, but you need to commit this change in order to commit the deletion into history.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.