Skip to content

Instantly share code, notes, and snippets.

@henrahmagix
Created July 20, 2016 16:02
Show Gist options
  • Save henrahmagix/deef25c2363308739a35b7fc9cb53dbb to your computer and use it in GitHub Desktop.
Save henrahmagix/deef25c2363308739a35b7fc9cb53dbb to your computer and use it in GitHub Desktop.
Git Presentation Demo: branches
git init
echo 'start' > start.txt
git add start.txt
git commit --message 'Initial commit'
git log
# Make a new branch
git branch new
git branch
git log new
git log master
# Make a change on the new branch
git checkout new
echo 'changed' > start.txt
git commit --all --message 'Changed start.txt'
git log
git checkout master
git log
git branch --delete new # Won't let you because commits would be lost
git merge new
git branch --delete new # Allowed
git branch
git log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment