Skip to the content.

Git notes

snippets

# for remote
git-sweep cleanup
# for local
git remote add local $(pwd)
git-sweep cleanup --origin=local
# remote
git push --delete origin v2.5.4
# local
git tag -d v2.5.4
git shortlog -sne --no-merges
git ls-files | wc -l
git ls-files | xargs cat | wc -l
git ls-files | xargs wc -l # detailed
git stash show -p stash@{2}
git stash apply stash@{2}
git stash drop stash@{2}
git diff --cached > mypatch.patch # --cached for staged changes
git checkout -- index.js
git rebase --onto <branch name>~<first commit number to remove> <branch name>~<first commit to be kept> <branch name>
git rebase --onto master~3 master~1 master
git branch --list 'temp*' | xargs git branch -D