I have made a round of changes to a branch and have 10 modified files and 10 files I have deleted.
If I run git add .
this will only add the modified files to my commit. I want to remove the deleted files from the remote repo as well as add my modified files.
I can use git rm filename
, but since I have so many files to remove I was wondering if there was a way to do an 'all'.
I Googled and found git rm -r *
but this doesn't seem to work.
Is there a command that will allow me to do this?
Enter git add --all at the command line prompt in your local project directory to add the files or changes to the repository. Enter git status to see the changes to be committed. Enter git commit -m '<commit_message>' at the command line to commit new files/changes to the local repository.
The easiest way to add all files to your Git repository is to use the “git add” command followed by the “-A” option for “all”. In this case, the new (or untracked), deleted and modified files will be added to your Git staging area. We also say that they will be staged.
If you want to stage all your changed and deleted files and commit in one-line:
git commit -am "changing and deleting files"
Note that this command won't add new files as Git is about tracking changes. It relies on you to tell it which files are important enough to track. If you have some or you just want to stage the changes before you commit, you will have to add your files manually or use wildcard:
git add -A
stages All (include new files, modified and deleted)git add .
stages new and modified, without deletedgit add -u
stages modified and deleted, without newthen commit:
git commit -m "..."
Try this:
git add -u
to stage all your changes including deleted/updated files.
Then just run git commit -m 'your commit message'
to commit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With