What does 'git stash -u' do?

QuestionsQuestions8 SkillsProSaving Work in ProgressSep, 30 2025
0103

The command git stash -u (or git stash --include-untracked) is used to stash changes in your working directory, including both tracked and untracked files.

Here's what it does:

  • Stashes Changes to Tracked Files: It saves modifications to files that Git is already tracking (i.e., files that have been added to the repository).

  • Includes Untracked Files: Unlike the regular git stash command, which only stashes changes to tracked files, the -u option also includes untracked files (files that are not yet added to the repository).

This is useful when you want to temporarily save all your changes, including new files that you haven't added to the staging area yet, before switching branches or performing other tasks.

0 Comments

no data
Be the first to share your comment!