stash
make sure local is clean and let's create a modification in a file.
git status - verified, clean
mate simple.html - add something
git status -> modified: simple.html
In this scenario, 'simple.html' will be a
1. working progress file and
2. I am not ready to commit
3. Now i need to modify another file
So in order to save the changes to 'simple.html' --> stash
With this i can save my working progress and start working on something else.
git stash -> by default this will call 'save'
git status ->
---------------------
On branch master
Your branch is upto date with 'origin/master'
nothing commit, working directory is clean.
mate simple.html --> changes are backto where it was
let's go ahead and modify some files
mate README.md
git status -> modified: README.md
git commit -am "Quick fix to production"
git status -> clean
What about stash file ? How to get it back.
git stash apply -> this will output 'git status' on working directory -> modified: simple.html
check the file
mate simple.html -> title or the change back to same, where it was before we run 'stash' command
So we can pick up where we left, amd start continue editing
let's commit our working progress
git commit -am "Done with simple.html"
git status -> clean
git stash list
stash{0}:WIP on master: 391f000 local: updating simple html.....
as we have used this, we do not need
So let's look at how to drop this
git stash drop -> that will drop the last stash
No comments:
Post a Comment