Skip to content

Instantly share code, notes, and snippets.

@avielb
Last active April 21, 2019 19:59
Show Gist options
  • Save avielb/9bbdae0040e0417493f7f968d5d2123d to your computer and use it in GitHub Desktop.
Save avielb/9bbdae0040e0417493f7f968d5d2123d to your computer and use it in GitHub Desktop.
# git download
# https://linode.com/docs/development/version-control/how-to-install-git-on-linux-mac-and-windows/
# git config
git config --global user.name "avielb"
git config --global user.email "aviel33@gmail.com"
# from git bash
mkdir my-first-project
cd my-first-project
git init
echo "hello world" > 1.txt
git add .
# checking out new branch
git branch develop
git checkout develop
git checkout -b develop1
#create merge issue
mkdir merge-issue
cd merge-issue
git init
Echo “hello” > a.txt
git add .
git commit -am "init commit"
git branch new-branch
git checkout new-branch
echo “world” > a.txt
git commit -am "I want to conflict"
git checkout master
echo “newer change in master” > a.txt
Git commit -am “34rd commit”
git merge new-branch
cat a.txt
# git revert and reset
mkdir git-reset-example
cd git-reset-example
git init
echo "1" > a.txt
git add .
git commit -am "init commit"
echo "2" > a.txt
git commit -am "2nd commit"
echo "3" > a.txt
git commit -am "3rd commit"
echo "4" > a.txt
git commit -am "4th commit"
git log
git revert <commit hash to revert> --no-edit --strategy-option theirs
git log
git reset <commit hash to reset to> --hard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment