Skip to content

Latest commit

 

History

History
69 lines (50 loc) · 1.53 KB

git.md

File metadata and controls

69 lines (50 loc) · 1.53 KB

git

Delete merged local branches

git remote prune origin # prunes tracking branches not on the remote
git branch —merged # lists branches that have been merged into the current branch
git branch -d ...

Shallow clone repository (single branch with truncated history)

git clone --depth 1 https://path/to/repo/foo.git -b bar

Enable Git autocorrection

git config --global help.autocorrect 1

Count commits

git rev-list --count
git rev-list --count dev

Optimize repo

git gc --prune=now --aggressive

View a file of another branch

git show main:README.md

Search

git rev-list –all | xargs git grep -F 'something'

GitHub

~/.gitconfig compatible with Rust cargo

[core]
	editor = vim
[url "[email protected]:"]
	insteadOf = https://github.com/
[url "[email protected]:"]
	insteadOf = https://bitbucket.org/
[url "https://github.com/rust-lang/crates.io-index"]
    insteadOf = https://github.com/rust-lang/crates.io-index
[url "https://github.com/rustsec/advisory-db"]
	insteadOf = https://github.com/rustsec/advisory-db