git clone --depth 1 [REPO_PATH]
git fetch --unshallow
git remote set-branches origin [SPECIFIC-BRANCH or * for all branches]
git fetch
git stash pop stash@{1}
git reset --hard HEAD^
git log --all -- [path/to/file]
git log [branch] -- [path/to/file]
git log --author=[author]
git cherry-pick [COMMIT]
git show --name-status [COMMIT]
git log -1 --stat -- [FILE]
git log origin/master..HEAD
Pop stash to retain renamed file - git stash pop --index
If you have popped stash without using the above then... git rm --cached [ORIGINAL_FILENAME]
Current stash
git stash show
Stash 1 level deep
git stash show stash@{1}
git checkout -b [BRANCH NAME]
git push -u origin [BRANCH NAME]
git log --follow ./path/to/file
git rm -r *.map
echo *.map >> .gitignore
git add .
git commit --amend --no-edit
git push origin --delete BRANCHNAME (remote)
git branch -d BRANCHNAME (local)
e.g. git push origin --delete BRANCHNAME; git branch -d BRANCHNAME
git remote set-url origin git://new.url.here
git diff branch1:file branch2:file
- compare two files with different filenames
or
git diff branch1 branch2 -- myfile.cs
- compare same file
git commit --amend -am "Amended commit message"
git log -1
e.g. reset past the last 2 commits
git reset --hard HEAD~2
e.g. reset from remote
git reset --hard origin/master
git reset HEAD <file>