Git
git cache password for specified time in secs
git config credential.helper 'cache --timeout=3600'
checkout locally someones PR
git fetch origin pull/ID/head:BRANCH_NAME
git switch BRANCH_NAME
git push origin BRANCH_NAME
or simple:
gh pr checkout <ID>
Revert last commit
git reset HEAD^
Fast-forward issue
Message: “fatal: Not possible to fast-forward, aborting.”
git pull --rebase
Nice git log history for greping
# Commit-id,name,date,descr
git log --format="%h (%an, %cs): %s"
# Filenames
git log --name-only --oneline
Git delete local branch that is not “online” anymore
git branch -d <branch-name>
git fetch origin --prune
Show only files that changed on previous commit
git diff-tree --no-commit-id --name-only -r HEAD
# instead of HEAD, can use specific <commit-hash>
Remove tag (local+remote)
# create
git tag -a v1.0.2 -m "My new version!"
# delete everywhere
git tag -d v1.0.2
git push origin :refs/tags/v1.0.2