Skip to content

Instantly share code, notes, and snippets.

@gerjantd
Created April 21, 2012 11:27
Show Gist options
  • Save gerjantd/2436695 to your computer and use it in GitHub Desktop.
Save gerjantd/2436695 to your computer and use it in GitHub Desktop.
Git: simple branch and merge example
git clone https://[email protected]/gerjantd/foo.git
cd foo
gitk
vi bugfix1
git status
git add bugfix1
git status
gitk
git commit -m "Added bugfix1"
gitk
git status
git push
gitk
git branch
git branch harebrained
git branch
gitk
git checkout harebrained
mkdir crazy
vi crazy/ridiculous
vi silly
git status
git add crazy/ silly
git status
git commit -m "Added crazy and silly"
gitk
git push -u origin harebrained
git checkout master
vi bugfix2
git add bugfix2
git commit -m "Added bugfix2"
git push origin master
git log --pretty=oneline
git branch
git branch harebrained
git checkout harebrained
git log --pretty=oneline
gitk
git branch
git merge master
git status
git push origin harebrained
git log --pretty=oneline
gitk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment