Exclude files with ".php~" from GIT ADD : git ls-files . | grep '\.php~$' | xargs git add Exclude files already added by GIT ADD : git ls-files . | grep '\.php~$' | xargs git reset --