Skip to content

Instantly share code, notes, and snippets.

@JosefJezek
Last active June 22, 2016 13:00
Show Gist options
  • Save JosefJezek/775e54583ef319c8c641 to your computer and use it in GitHub Desktop.
Save JosefJezek/775e54583ef319c8c641 to your computer and use it in GitHub Desktop.
How to use Git

How to use Git

Undo

Setup

git config --global user.name ""
git config --global user.email "@.com"

Aliases

git config --global alias.ch checkout
git config --global alias.br branch
git config --global alias.co commit
git config --global alias.st status
git config --global alias.unstage 'reset HEAD --'
git config --global alias.last 'log -1 HEAD'

Cloning with SSH on Linux

Config ~/.ssh/config

Host github.com
  User git
  VerifyHostKeyDNS yes
  IdentityFile ~/.ssh/id_rsa_github

Generate Key

ssh-keygen -t rsa -f ~/.ssh/id_rsa_github -C "@.com"
ssh-add ~/.ssh/id_rsa_github
ssh-add -l
cat ~/.ssh/id_rsa_github.pub

Clone repository to separate branch

git clone https://github.com/StartPolymer/polymer-starter-kit.git <my-repo-name>
cd <my-repo-name>
git branch -m psk
git checkout -b master
git remote rename origin psk
git remote add origin https://github.com/<user>/<my-repo-name>.git
git push -u origin master

Merge

git fetch psk
git merge psk/master

Push All

git push -u origin --all

Tutorials

Cheat Sheets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment