Here are some commands I use rather frequently.
git rebase --onto new-parent old-parent
- Change parent branch of a fork
git remote prune origin
- Clean up git remotes
git rebase -i <other-branch>
- Dropping, squashing, rewording a list of commits
Gets all merges within a range of dates
Dates must be a ISO format: YYYY-MM-DDTHH:MM:SS
git log --pretty=format:'%aI %H' --first-parent | \
awk '$1 >= "<start date>" && $1 <= "<end date>" { print $2 }' | \
git log --pretty=format:'%an|%s' --no-walk --stdin | \
column -t -s '|'
Cherry pick a particular file from a commit to the current branch from here
git show YOURHASH --no-color -- file1.txt file2.txt dir3 dir4 | git apply -3 --index -
git rebase -i HEAD~n # replace n with a number
# replace commits from pick to edit
git commit --amend --author 'new author name <new author email>' --no-edit
git rebase --continue
lsof -i :8080
- List running processes listening to a certain port (e.g. 8080)
ulimit -n 8192
- When there are not enough file descriptors due to too many open files
docker system prune
- Not enough disk space due to Docker shenanigans
*cgn
or cgn
to replace a word - repeat the replacement with .
yy
30p
- to copy a line and then paste 30 times (the number can be changed accordingly)
\x
for expanded view - useful for easily viewing records
\pset format wrapped
- good for viewing table definitions