// deletes the last commit
git reset --hard HEAD^
// where X is the number of commits to undo
git reset HEAD~X
Display total lines of code in a git branch
git diff 5cec833a 4ef01d13 --stat
// where the hex are commit id's to differentiate.
Change git author name
git config --global user.name "Christopher Snay"
Save git credentials
git config --global credential.helper store
Remove from git tracking
git rm --cached <file>
git rm --cached <directory> -r
edit git commit details
git rebase -i 0abc12def // <- the commit before the one that needs edit
// use vi to change "pick" to "edit" on the commit(s) that need edits, then write/quit
git commit --amend --author="Christopher Snay <email@email.com>"
// write/quit vi
git rebase --continue // <- repeat until all edited commits complete
git push -f
Undo git changes forcibly
git reset --hard HEAD
Initial git push via HTTPS
git init
git remote add origin https://<<<repo>>>.git
git add .
git commit -m "some comments"
git push -u origin master
initial git pull via SSH
// after setting up a public ssh key
// cd to new directory
git init
git remote add origin git@bitbucket.org:<<<me>>>/<<<project>>>.git
git pull origin master
ssh key generation
ssh-keygen
// copy contents from C:\Users\<<<me>>>\.ssh\id_rsa.pub
// paste contents to: https://bitbucket.org/account/user/<<<me>>>/ssh-keys/
ssh key generation to a specific directory
ssh-keygen -f C:\somepath\filename
initial push to git via SSH
git init
git add .
git remote add origin git@bitbucket.org:<<<myaccountname>>>/<<<project>>>.git
git commit -m "comment"
git push -u origin master