Skip to content

Instantly share code, notes, and snippets.

@hugolu
Last active January 15, 2017 02:13
Show Gist options
  • Save hugolu/e2c88ddd18d0719f3f48dfc883130a71 to your computer and use it in GitHub Desktop.
Save hugolu/e2c88ddd18d0719f3f48dfc883130a71 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 @master
echo 1 >> file
git add .
git commit -m "1"
echo 2 >> file
git commit -am "2"
# create branch and change to it
git checkout -b dev
# commit changes @dev
echo 3 >> file
git commit -am "3"
# switch branch
git checkout master
# commit changes @master
echo 4 >> file
git commit -am "4"
# merge branch
git merge dev
# fix conflict
sed -i '' -e "/<<<<<<</d" -e "/=======/d" -e "/>>>>>>>/d" file
git commit -am "fix conflict"
# show log
git log --oneline --graph --all
# delete branch
git branch -d dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment