Different between "git add --all" and "git add ."

At first, I always use "git add ." in the work, but I some times, I find if I remove some files in the track tree,and then push the "New Version" to remote git server, then I still can find the removed files in native git. so how is it? I need to delete the files in the server. So I will do like this: git

For File:

git rm --cached filename

git commit -m "delete file in remote git."

git push [origin] [master]

For Folder:

git rm -r --cached foldername

git commit -m "delete folder in remote git."

git push [origin] [master]

It is so non-convenient,right? So how to avoid doing like this? shell

Way is using "git add --all" this

"git add --all" == "git add ." + "git add -u" spa

"git add ." means track all the files that "new" and "modified"; code

"git add -u" means track all the files that "modified" and "deleted" server

So in the project, if you just use "git add ." to track all the files, it will be work ok, but you should deal with all the dirty files in the remote git server. rem

Reference link:http://stackoverflow.com/questions/572549/difference-between-git-add-a-and-git-add get

Thanks, it

Blues io

相關文章
相關標籤/搜索