Assuming you mean you haven't yet committed, and want to package up all of the files that currently have local modifications, you can get the list of modified files with git ls-files --modified. If you want the files which were changed by the last commit, you could use git diff --name-only HEAD^. Where you go from there is up to you. Examples:
zip modified-files.zip $(git ls-files --modified)
cp $(git ls-files --modified) ../modified-files
Note that this is using the versions of files in the working tree currently.
If you have spaces in filenames, you'll have to go to a little more trouble.
(Of course, depending on what you're really trying to do, you might be looking for git stash, which stashes away all modified files and leaves you with a clean working tree, or you could simply want to make a temporary branch to commit to.)
If you use TortoiseGIt, it provides this too.
Choose the folder, in explorer
Right click,Choose menu, TortoiseGit-> Show Log.
Select working directory and the last commiitted version.
Right click. Compare revisions. Select files you want to save/export.
Right Click. Export to folder. Done.
Here is a script which can make this process a lot easier, it will copy all changed file to used defined directory and also maintain the directory structure of code base.
run:
sh scr.sh
================================================
#!/bin/sh
FILES=`git ls-files --modified`
for x in $FILES
do
prev_dir=$PWD
echo "MY Dir = $prev_dir"
mkdir -p $1/$x
cd $1/$x
cd ../
rm -r *
cp $prev_dir/$x ./.
cd $prev_dir
done
If you have TortoiseGit, even before committing also you can export all the changed files to folder (which contains files under proper directory structure). Just perform following steps.
Right click on folder which you want to see changes
Had the same requirement.
Got the input from the first answer and created a tool (Windows Only) for myself.
Which copies all the added/ modified files to a backup folder.
You can export your last modified files via git ls-files --modified
Just create a .sh file with the following code And execute it.
#!/bin/sh
FILES=`git ls-files --modified`
export_dir="place your export dir"
for x in $FILES
do
prev_dir=$PWD
folder=$(dirname $x)
echo "Exporting to..." $export_dir/$x
cp $prev_dir/$x $export_dir/$x
done