Skip to content

Instantly share code, notes, and snippets.

@ihaveaproblem
Forked from ramesaliyev/Git Cheat Sheet
Created October 22, 2015 08:25
Show Gist options
  • Save ihaveaproblem/b321dc2cf7110b801017 to your computer and use it in GitHub Desktop.
Save ihaveaproblem/b321dc2cf7110b801017 to your computer and use it in GitHub Desktop.
Git Cheat Sheet
- Create a repository
git init <repo-name>
git clone <url> <directory-name>
git clone -o <remote-name> <url>
- Commiting
git add <filename>
git commit -m "Commit Message"
git commit -am "Commit Message"
- Remote
git remote
git remote show <remote-name>
git remote add <remote-name> <remote repository URL>
git push <remote-name> <branch-name>
- Branch
git branch <branch-name>
git branch -d <branch-name> (delete)
git push origin :<branch-name> (delete from remote)
git checkout <branch-name>
git checkout -b <branch-name> (create and switch)
- Merge
git merge <branch-to-merge>
- Reset
git log
git checkout <commit-id>
git reset HEAD --hard
- Credentials
git config credential.helper store
- Other Configs
git config push.default simple
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment