DDMAL / DDMAL/Rodan

careful: git stash (and pop) will not save everything

Open
#1,226 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
CSS
Stars
46
Forks
13
PR merge metrics
No merged PRs in 30d

Description

The following content is generated by ChatGPT (free version):

`git stash` does not save everything by default for a few reasons:

1. **Untracked Files**: `git stash` only stashes changes to tracked files, meaning files that Git is already aware of (i.e., files that are staged or have been committed before). Untracked files (new files that haven't been added to the staging area) are not included in the stash unless you use the `-u` or `--include-untracked` option.

2. **Ignored Files**: Files that are listed in `.gitignore` or otherwise ignored by Git will not be stashed. If you want to include ignored files, you need to use the `-a` or `--all` option, which will also stash ignored files.

3. **Staged Changes**: By default, `git stash` only stashes the changes that are in your working directory (i.e., unstaged changes). If you also want to stash changes that are already staged (in the index), you can use the `--staged` option (`git stash --staged`).

### To summarize:
- Use `git stash -u` to include untracked files.
- Use `git stash -a` to include ignored files as well.
- Use `git stash --staged` to include staged changes.

If you want to stash everything, including both tracked and untracked files, and any changes in the staging area, use:
```bash
git stash -u --staged

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.