Posts tagged: git

All posts with the tag "git"

📝 Git Notes

See old revisions of one file ¶ # git log --oneline -- git log -n 2 --oneline -- Checkout an old revision of a file ¶ # git checkout -- path/to/file fuzzy pick a file and check out an old revision ¶ # #!/usr/bin/env bash set -euo pipefail file="${1:-}" if [[ -z "${file}" ]]; then file="$(git ls-files | fzf --prompt="select file > ")" || exit 0 fi if [[ -z "${file}" ]]; then exit 0 fi if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then echo "Not a git repository." >&2 exit 1 fi if ! git ls-files --error-unmatch -- "${file}" >/dev/null 2>&1; then echo "File is not tracked by git: ${file}" >&2 exit 1 fi choice="$( git log --follow --pretty=format:'%h %ad %s' --date=short -- "${file}" | fzf --ansi --no-sort --reverse \ --preview-window=down:70% \ --prompt="checkout revision > " \ --preview "git show --color=always {1}^..{1} -- '${file}' 2>/dev/null || git show --color=always {1} -- '${file}'" )" if [[ -z "${choice}" ]]; then exit 0 fi commit="$(awk '{print $1}' <<<"${choice}")" git checkout "${commit}" -- "${file}"
1 min read
git

is a great way to see what files have changed in a git diff alongside the status code. I recently used this in a scri...

git

The tea command for gitea (used by forgejo) has a flag for login. With gitea you can have multiple accounts logged in...

I love getting faster in my workflow, something I have recently added in is creating GitHub repos with the cli. I oft...

git

Sometimes you have a pretty old branch you are trying to merge into and you are absolutely sure what you have is what...

git

I was editing some blog posts over ssh, when I ran into this error. gpg was failing to sign my commits. I realized th...

git

Setting up your git pager to your liking can help you navigate diffs and logs much more efficiently. You can set it t...