git branch -d (the_local_branch)
git diff --staged
git push origin :(the_remote_branch)
git checkout foo.txt
git reset HEAD foo.txt
git reset --soft HEAD^ foo.txt
git commit --amend -m "My new commit"
If you have files in staging, they will be used on the new commit.
git diff (or difftool) mybranch master -- myfile
The same arguments can be passed to git difftool
if you have one configured.
git checkout -t origin/branch-name
[alias]
log1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
log2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git log1"
git log --author="My name" --after="7 days ago"
git stash show -p stash@{0} | git apply -R
Git does not provide such a stash unapply
command, but it is possible to achieve the effect by simply retrieving the patch associated with a stash and applying it in reverse.
git blame --line-porcelain path-file |
sed -n 's/^author //p' |
sort | uniq -c | sort -rn
Count the number of lines attributed to each author