Skip to main content
In the deleted row there are only 2 colums sepaerated by white space, so print $3 would fail to produce an output. Since edits must be at leasst six characters, one improvement would be to remove the back ticks and spawn a sub-shell.
Source Link

To stage only the deleted files:

for x in `git$(git status | grep deleted | awk '{print $3$2}'`;'); do git rm $x; done 

Or (the xargs way):

git status | awk '/deleted/ {print $3$2}' | xargs git rm 

You can alias your preferred command set for convenient later use.

To stage only the deleted files:

for x in `git status | grep deleted | awk '{print $3}'`; do git rm $x; done 

Or (the xargs way):

git status | awk '/deleted/ {print $3}' | xargs git rm 

You can alias your preferred command set for convenient later use.

To stage only the deleted files:

for x in $(git status | grep deleted | awk '{print $2}'); do git rm $x; done 

Or (the xargs way):

git status | awk '/deleted/ {print $2}' | xargs git rm 

You can alias your preferred command set for convenient later use.

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

To stage only the deleted files:

for x in `git status | grep deleted | awk '{print $3}'`; do git rm $x; done 

Or (the xargs way):

git status | awk '/deleted/ {print $3}' | xargs git rm 

You can aliasalias your preferred command set for convenient later use.

To stage only the deleted files:

for x in `git status | grep deleted | awk '{print $3}'`; do git rm $x; done 

Or (the xargs way):

git status | awk '/deleted/ {print $3}' | xargs git rm 

You can alias your preferred command set for convenient later use.

To stage only the deleted files:

for x in `git status | grep deleted | awk '{print $3}'`; do git rm $x; done 

Or (the xargs way):

git status | awk '/deleted/ {print $3}' | xargs git rm 

You can alias your preferred command set for convenient later use.

Post Merged (destination) from stackoverflow.com/questions/1402776/…
Added xargs alternative
Source Link
Saeb Amini
  • 24.6k
  • 10
  • 85
  • 78

To stage only the deleted files:

for x in `git status | grep deleted | awk '{print $3}'`; do git rm $x; done 

Which youOr (the xargs way):

git status | awk '/deleted/ {print $3}' | xargs git rm 

You can aliasalias your preferred command set for convenient later use.

To stage only the deleted files:

for x in `git status | grep deleted | awk '{print $3}'`; do git rm $x; done 

Which you can alias for convenient later use.

To stage only the deleted files:

for x in `git status | grep deleted | awk '{print $3}'`; do git rm $x; done 

Or (the xargs way):

git status | awk '/deleted/ {print $3}' | xargs git rm 

You can alias your preferred command set for convenient later use.

deleted 59 characters in body
Source Link
Saeb Amini
  • 24.6k
  • 10
  • 85
  • 78
Loading
added 49 characters in body
Source Link
Saeb Amini
  • 24.6k
  • 10
  • 85
  • 78
Loading
better grammar
Source Link
Saeb Amini
  • 24.6k
  • 10
  • 85
  • 78
Loading
Source Link
Saeb Amini
  • 24.6k
  • 10
  • 85
  • 78
Loading