git init
git add .
git commit -m 'Initial import.'
git remote add origin ${URL}
git push --set-upstream origin master
git log --graph --all --decorate
git diff --patch-with-raw > out.patch
git diff HEAD~1 --relative
git symbolic-ref refs/heads/master refs/heads/main
git checkout --detach --quiet HEAD && git fetch origin master:master && git checkout --quiet -
git branch --merged
git branch -d merged-branch-name
git branch --no-merged
git branch -D un-merged-branch-name
git gc --prune=now
git prune
git remote prune origin
git branch -r
git remote prune origin
# Or just fetch with -p
git fetch -p
for branch in `git branch -r --merged | grep -v HEAD`; do \
echo -e `git show --format="%ci %cr %an" $branch | head -n 1` \\t$branch; \
done | sort -r
git log -p -2
git rebase -i $(git rev-list --max-parents=0 HEAD)
# Change all but the first "pick" to "squash"
git push --force
# Alternatively:
git rebase -i --root
git fetch
git reset origin/$(git branch --show-current) --hard
git remote set-url origin git://$URL
git config user.name "andornaut" \
&& git config user.user "andornaut" \
&& git config user.email "[email protected]"
mkdir repo-git
cd repo-git
git init
hg-fast-export.sh -r <repo> -B <branches_map> -A <users_map>
# Ignore
git update-index --assume-unchanged ${filepath}
# Unignore
git update-index --no-assume-unchanged ${filepath}
git tag -d v0.0.1
git push origin :refs/tags/v0.0.1
# Revert a merge commit
git revert -m 1 ${MERGE_COMMIT_SHA}
[alias]
dbr = !bash -c 'set -o pipefail && git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null|cut -d / -f 4-||git remote show origin 2>/dev/null|awk \"/HEAD branch/ {print \\$NF}\"||echo main'
Stackoverflow - Allow git to set your origin/HEAD, determining what branch to use automatically
git remote set-head origin --auto
<details><summary>Click here to expand</summary>
This section is hidden until the above is clicked.
</details>
- GitHub searching-issues-and-pull-requests
- GitHub using-search-to-filter-issues-and-pull-requests
- GitHub Filtering and searching issues and pull requests
# What
archived:false
is:closed
is:pr,issue
# Who
org:wmgtech
author:andornaut
involves:andornaut
reviewed-by:andornaut
# PRs where andornaut is a reviewer and not author
reviewed-by:andornaut -author:andornaut
# Date/time
created:>=2024-12-31
merged:2024-01-01..2024-12-31
Example searches:
- Pull requests
org:wmgtech is:pr author:andornaut
- Pull requests
org:wmgtech is:pr involves:andornaut
- Pull requests
org:wmgtech is:pr reviewed-by:andornaut -author:andornaut
- Configure schedule reminders for PR reviews and other things
- Add a
.patch
extension to a GitHub commit, diff, or PR URL to download a raw git patch, eg. https://github.com/andornaut/til/commit/5bbb06b4ce76443f9217546ee57738ae2ab4cd9a.patch