The end of git status looks like this:
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# Classes/Default.png
# Classes/Default@2x.png
...
Since you might have any number of untracked files, I’m trying to tail from the end of the file to “Untracked files” and save it to a temp file, strip out the first three lines and convert the filenames to git add Classes/…
I can’t seem to find a good way (other than maybe a different language) to tail up to a searchable expression. Thanks!
Use the tail command:
How it works:
total number of lines in file =
wc -l < file.txtline number of “Untracked files” =
grep -n "Untracked files" file.txt|cut -d: -f1The
-2is to remove the top linesComplete command with
git add: