Update Update Guide authored by Jonathan Jones's avatar Jonathan Jones
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
# Pulling from git when your local version has been modified # Pulling from git when your local version has been modified
Here's a typical scenario: Here's a typical scenario:
``` console ``` bash
user@host:~/repo/blocks$ git checkout <branch> user@host:~/repo/blocks$ git checkout <branch>
(git tells you it won't check out <branch> because you have changes you haven't committed) (git tells you it won't check out <branch> because you have changes you haven't committed)
``` ```
...@@ -25,28 +25,28 @@ You now have three choices: ...@@ -25,28 +25,28 @@ You now have three choices:
3. Store the changes locally, because you're not sure if you want them yet 3. Store the changes locally, because you're not sure if you want them yet
In case 1, you do: In case 1, you do:
``` console ``` bash
user@host:~/repo/blocks$ git commit -am "<commit message>" user@host:~/repo/blocks$ git commit -am "<commit message>"
user@host:~/repo/blocks$ git push user@host:~/repo/blocks$ git push
``` ```
In case 2, you do: In case 2, you do:
``` console ``` bash
user@host:~/repo/blocks$ git reset --hard HEAD user@host:~/repo/blocks$ git reset --hard HEAD
``` ```
In case 3, you do: In case 3, you do:
``` console ``` bash
user@host:~/repo/blocks$ git stash user@host:~/repo/blocks$ git stash
``` ```
After doing any of these three things you should be able to check out the branch you want without any issues. After doing any of these three things you should be able to check out the branch you want without any issues.
``` console ``` bash
user@host:~/repo/blocks$ git checkout <branch> user@host:~/repo/blocks$ git checkout <branch>
``` ```
**BONUS:** Let's assume you were in case 3 and you stashed the changes, then checked out a working branch. Now you want to switch back to master and get back the changes you made. Here's what you do: **BONUS:** Let's assume you were in case 3 and you stashed the changes, then checked out a working branch. Now you want to switch back to master and get back the changes you made. Here's what you do:
``` console ``` bash
user@host:~/repo/blocks$ git checkout master user@host:~/repo/blocks$ git checkout master
user@host:~/repo/blocks$ git stash pop user@host:~/repo/blocks$ git stash pop
``` ```
... ...
......