Interesting point on using git stash to save changes for later; the production bug fix use case is exactly what I use git stash for the most.
For those wondering about the command line process:
(feature/xyz)$ git status
On branch feature/xyz
Untracked files:
(use "git add <file>..." to include in what will be committed)
somefile.txt
nothing added to commit but untracked files present (use "git add" to track)# Add changes to the index(feature/xyz)$ git add -A# Stash changes, possibly leave a message through the -m argument(feature/xyz)$ git stash
Saved working directory and index state WIP on feature/xyz: 076cc04 some-previous-commit
HEAD is now at 076cc04 some-previous-commit
# We're now in a clean state, ready to go fix the bug on master(feature/xyz)$ git checkout master
(master)$ ./do-and-commit-stuff.sh
# Now come back to your branch and put back your changes from the stash(master)$ git checkout feature/xyz
(feature/xyz)$ git stash apply
On branch feature/xyz
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: somefile.txt # <- previous changes are back! 🎉
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Interesting point on using
git stash
to save changes for later; the production bug fix use case is exactly what I usegit stash
for the most.For those wondering about the command line process: