Skip to content

Instantly share code, notes, and snippets.

@jedschneider
Created January 10, 2011 21:35
Show Gist options
  • Select an option

  • Save jedschneider/773511 to your computer and use it in GitHub Desktop.

Select an option

Save jedschneider/773511 to your computer and use it in GitHub Desktop.
git lesson
### git branch i'm on defined in parens (branch) ###
### first part of output truncated for brevity ###
∵ mkdir git_lesson
∵ cd git_lesson/
∵ touch file_a
∵ git init
∵ git add .
∵ git commit -m "initial"
(master) ∵ echo "a change" >> file_a
(master) ∵ git add .
(master) ∵ git commit -m "a change made"
(master) ∵ git checkout -b production
(production) ∵ git checkout master
(master) ∵ git checkout -b staging
(staging) ∵ git checkout master
(master) ∵ touch file_b
(master) ∵ echo "file_b" >> file_b
(master) ∵ git add .
(master) ∵ git commit -m "adding file b"
(master) ∵ git checkout production
(production) ∵ git checkout -b fix
(fix) ∵ sed -i ".back" 's/a/the best/' file_a
(fix) ∵ git add .
(fix) ∵ git commit -m "fixing for the best change"
###### here is the graph at this point ######
(fix) ∵
* ef085d6 (HEAD, fix) Jed Schneider--fixing for the best change
| * cc2d8a5 (master) Jed Schneider--adding file b
|/
* 47f451e (staging, production) Jed Schneider--a change made
* 18a0f6c Jed Schneider--initial
(fix) ∵ git checkout master
(master) ∵ git merge fix
Merge made by recursive.
file_a | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
(master) ∵ glog
* a83458b (HEAD, master) Jed Schneider--Merge branch 'fix'
|\
| * ef085d6 (fix) Jed Schneider--fixing for the best change
* | cc2d8a5 Jed Schneider--adding file b
|/
* 47f451e (staging, production) Jed Schneider--a change made
* 18a0f6c Jed Schneider--initial
(master) ∵ git checkout production
Switched to branch 'production'
(production) ∵ git merge fix
Updating 47f451e..ef085d6
Fast-forward
file_a | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
(production) ∵ glog
* a83458b (master) Jed Schneider--Merge branch 'fix'
|\
| * ef085d6 (HEAD, production, fix) Jed Schneider--fixing for the best change
* | cc2d8a5 Jed Schneider--adding file b
|/
* 47f451e (staging) Jed Schneider--a change made
* 18a0f6c Jed Schneider--initial
### OK now merge master into production it fast-forwards ######
(production) ∵ git merge master
Updating ef085d6..a83458b
Fast-forward
file_b | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 file_b
(production) ∵ glog
* a83458b (HEAD, production, master) Jed Schneider--Merge branch 'fix'
|\
| * ef085d6 (fix) Jed Schneider--fixing for the best change
* | cc2d8a5 Jed Schneider--adding file b
|/
* 47f451e (staging) Jed Schneider--a change made
* 18a0f6c Jed Schneider--initial
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment