A Quick and Easy Way to Export All Git Changes (Tracked + Untracked)

Sometimes, you just need to grab all your changes in a Git repo—tracked, untracked, staged, everything—and move them somewhere else. After playing around with a bunch of methods, I’ve settled on a super simple solution: stashing + exporting.

Here’s how it works and why I love it.


Why Stash + Export Works So Well

First, it’s easy. You don’t need to mess with fancy commands or worry about missing files. It just works. Second, it’s safe—your stash is like a little safety net you can restore anytime. And honestly, it’s just nice not to have to think too hard about this stuff.


How to Do It

  1. Stash Everything
    Run this command to stash all your changes, including untracked files:

    git stash push --include-untracked

    Want to go even further and include files ignored by .gitignore? Use this:

    git stash push --all

    Now all your changes are tucked away in the stash.

  2. Check Your Stash
    To make sure everything’s safe, list your stashes:

    git stash list

    You’ll see something like this:

    stash@{0}: WIP on main: Save current work

    The stash@{0} bit is the ID you’ll need.

  3. Export the Stash
    Create a patch file with everything in the stash:

    git stash show -p stash@{0} > export.patch

    This will save all your changes into export.patch. Super easy.

  4. (Optional) Reapply the Stash
    If you want your changes back in your working directory, just run:

    git stash apply stash@{0}
  5. (Optional) Clean Up
    Once you’ve exported and don’t need the stash anymore, you can delete it:

    git stash drop stash@{0}

Using the Patch Somewhere Else

When you’re ready to use your exported changes:

  1. Copy the export.patch file to wherever you need it.
  2. Apply it with:
    git apply export.patch

Done! Your changes are restored exactly as they were. 🎉


Why I Keep Coming Back to This Method

It’s quick. It’s simple. And it works every time. I’ve tried other approaches—like git diff with untracked files—but they always felt clunky. Stash + export is my go-to now, and I’ve never looked back.

So, next time you need to grab all your Git changes and move them somewhere else, give this a shot. It’s saved me a ton of hassle, and I’m sure it’ll do the same for you. 😊