I have deleted a file in my local system. Now I would like to update the locale branch + remote branch . So that the file is removed from the remote branch as well.
I did
git add -u
It deletes the removed file from the local branch but the file still stays in remote branch.
How can I delete the file from remote branch too?
You have to commit your changes (the deletion of 1 file):
git commit -m "One file deletion"
And push it to remote branch:
git push
you need to push your changes to remove using. Ensure you pull the latest code first
git pull
git commit -m "Your message"
git push
Try removing the cached files:
git rm -r --cached .
git add .
git commit -m "cached problems"
git push
Remove a file from local repository should automatically reflect itself on the remote repository once you pushed it.
You first need to commit your changes though:
git commit -m "Removed a file"
And after that push your code with git push
If you want to keep your local file, but remove it from online you'll have to use the
git rm <file-name> --cached
as the answers above stated + you'll need to add it to your .gitignore file so any changes to that file would be ignored.
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.