Created
November 13, 2018 18:01
-
-
Save weirdpattern/d89812d518fc5bc9161b4a420391c701 to your computer and use it in GitHub Desktop.
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
2018.11.13.stash-all-changes |
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
# adds a new file | |
$ touch file.txt | |
# update .gitignore to include file.txt | |
$ "file.txt" > .gitignore | |
# get the status | |
$ git status | |
On branch master | |
Your branch is up to date with 'origin/master'. | |
Changes not staged for commit: | |
(use "git add <file>..." to update what will be committed) | |
(use "git checkout -- <file>..." to discard changes in working directory) | |
modified: .gitignore | |
no changes added to commit (use "git add" and/or "git commit -a") | |
# stash changes (stashes .gitignore and file.txt) | |
$ git stash --all | |
# get the status | |
$ git status | |
On branch master | |
Your branch is up to date with 'origin/master'. | |
nothing to commit, working tree clean |
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
# adds a new file | |
$ touch file.txt | |
# update .gitignore to include file.txt | |
$ "file.txt" > .gitignore | |
# get the status | |
$ git status | |
On branch master | |
Your branch is up to date with 'origin/master'. | |
Changes not staged for commit: | |
(use "git add <file>..." to update what will be committed) | |
(use "git checkout -- <file>..." to discard changes in working directory) | |
modified: .gitignore | |
no changes added to commit (use "git add" and/or "git commit -a") | |
# stash changes (stashes .gitignore, file.txt becomes available as it's no longer ignored) | |
$ git stash --include-untracked | |
# get the status | |
$ git status | |
On branch master | |
Your branch is up to date with 'origin/master'. | |
Untracked files: | |
(use "git add <file>..." to include in what will be committed) | |
file.txt | |
nothing added to commit but untracked files present (use "git add" to track) |
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
# stash everything (tracked, untracked, ignored) | |
git stash --all | |
# stash everything, (tracked and untracked, but not ignored) | |
git stash [save -u | --include-untracked] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment