My Git Cheat Sheet

Merge a pull request into a new local branch:
git fetch origin pull/1234/head:pr-1234

Remove all history from a repository:
cd ~/yourrepo
git init
git add .
git commit -m "Initial commit"
git remote add origin <git-url>
git push -u --force origin master

Merge changes from master into a branch:
git checkout your-branch
git rebase master

Clean up files that are not part of a repository:
git diff --diff-filter=D --name-only -z | xargs -0 git rm

Quick git add/commit/push
git add -A .; git commit -m "gitquick commit"; git push;

%d bloggers like this: