Skip to content

Instantly share code, notes, and snippets.

@mchinen
Created May 29, 2014 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mchinen/7e2db41f5db7fa1ff146 to your computer and use it in GitHub Desktop.
Save mchinen/7e2db41f5db7fa1ff146 to your computer and use it in GitHub Desktop.
backup git clean files before cleaning
# get the list of clean files
git status>cleanlist
# go in with an editor and delete everything before "Untracked files:\n (use "git add...") "
openuptexteditoranddeletethenon-untrackedfilelinesuntilwehavearealcommandtodothisautomatically
mkdir cleanbackupdir
sed -e "s/^\(.*\)$/mv \\1 cleanbackupdir/g"<cleanlist > cleanlistcmd
chmod +x cleanlistcmd
./cleanlistcmd
mv cleanbackupdir ~/somewheresafe/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment