diff options
author | LOZORD <ljrudberg@gmail.com> | 2014-11-24 19:39:44 -0600 |
---|---|---|
committer | LOZORD <ljrudberg@gmail.com> | 2014-11-24 19:39:44 -0600 |
commit | 8b442c2497962b3b47844da74a416075313dc428 (patch) | |
tree | 55abd6f5fc8f1f45b4fa38466afaa8f10d374fb8 | |
parent | 3a8b9f0fc5397fb824cb49ecf6efd4a0c916b339 (diff) |
Only bashified the code sections
-rw-r--r-- | git.html.markdown | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/git.html.markdown b/git.html.markdown index e064122d..7778fdd4 100644 --- a/git.html.markdown +++ b/git.html.markdown @@ -336,40 +336,45 @@ $ git push ### stash -Stashing takes the dirty state of your working directory and saves it on a -stack of unfinished changes that you can reapply at any time. +Stashing takes the dirty state of your working directory and saves it on a stack of unfinished changes that you can reapply at any time. -```bash -# Let's say you've been doing some work in your git repo, but you want to pull from the remote. -# Since you have dirty (uncommited) changes to some files, you are not able to run 'git pull'. -# Instead, you can run 'git stash' to save your changes onto a stack! +Let's say you've been doing some work in your git repo, but you want to pull from the remote. +Since you have dirty (uncommited) changes to some files, you are not able to run 'git pull'. +Instead, you can run 'git stash' to save your changes onto a stack! +```bash $ git stash Saved working directory and index state \ "WIP on master: 049d078 added the index file" HEAD is now at 049d078 added the index file (To restore them type "git stash apply") +``` -# Now you can pull! +Now you can pull! +```bash git pull -# ...changes apply... +``` +...changes apply... -# Now check that everything is OK +Now check that everything is OK +```bash $ git status # On branch master nothing to commit, working directory clean +``` -# You can see what 'hunks' you've stashed so far: -# Since the 'hunks' are stored in a Last-In-First-Out stack -# our most recent change will be at top +You can see what 'hunks' you've stashed so far: +Since the 'hunks' are stored in a Last-In-First-Out stack our most recent change will be at top +```bash $ git stash list stash@{0}: WIP on master: 049d078 added the index file stash@{1}: WIP on master: c264051 Revert "added file_size" stash@{2}: WIP on master: 21d80a5 added number to log +``` -# Now let's apply our dirty changes back by popping them off the stack -# 'git stash apply' also works too +Now let's apply our dirty changes back by popping them off the stack +```bash $ git stash pop # On branch master # Changes not staged for commit: @@ -378,9 +383,10 @@ $ git stash pop # modified: index.html # modified: lib/simplegit.rb # +``` +'git stash apply' also works too -# Now you're good to go! - +Now you're ready to get back to work on your stuff! [Additional Reading.](http://git-scm.com/book/en/v1/Git-Tools-Stashing) ### rebase (caution) |