Last active
August 29, 2015 14:10
-
-
Save stephanb/5f83e2f3af6edc409ec0 to your computer and use it in GitHub Desktop.
Git: add all modified files to the index; delete all removed files from the index
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git add $(git status | grep "modified:" | cut -d " " -f 4) | |
git rm $(git status | grep "deleted:" | cut -d " " -f 5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you're presented with a long list of modified and deleted files in your Git repository, e.g. after a version update, you might find the commands above handy. They split all lines from
git status
containingmodified:
ordeleted:
by single space characters (cut -d " "
) and pass the 4th/the 5th field (-f 4
,-f 5
) togit add
/git rm
.If there's still a long list of untracked files after that, it's probably as easy as
git add .
to add them to the index. Don't forget togit push
after all ;)