Skip to content

Instantly share code, notes, and snippets.

@hugolu
Last active January 15, 2017 02:12
Show Gist options
  • Save hugolu/150f629dd52f9ec469895dbaa10d438f to your computer and use it in GitHub Desktop.
Save hugolu/150f629dd52f9ec469895dbaa10d438f to your computer and use it in GitHub Desktop.
# init repository
rm -rf learn-git
mkdir learn-git
cd learn-git
git init
# commit changes
echo 1 >> file
git add .
git commit -m "1"
echo 2 >> file
git commit -am "2"
# show commit log
git log
git log --pretty=oneline
git log --oneline
# create branch
git branch dev
git branch
# switch branch to dev
git checkout dev
git branch
# commit changes
echo 3 >> file
git commit -am "3"
# switch branch to master
git checkout master
git log --oneline
git log --oneline --all
# merge branch (fast-forward)
git merge dev
git log --oneline
# delete branch
git branch -d dev
git branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment