Last active
June 20, 2025 17:25
-
-
Save hugopereira84/708777a4592e2818231d to your computer and use it in GitHub Desktop.
Git, show all changed files
This file contains hidden or 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
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.) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment