Last active
February 18, 2022 02:24
-
-
Save khandar-william/574cbefc724945623bf17cf1ee952535 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// git: To delete all local branches that are already merged into the currently checked out branch: | |
git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d | |
// git: Delete local git branch | |
git branch -D <branch_name> | |
// git: Delete remote git branch | |
git push <remote_name/origin> --delete <branch_name> | |
// git: Pick specific file from another branch | |
git checkout <branch_name> -- <path_to_file> | |
// git: Sync a directory from another branch (include sync deleted files) | |
git restore --source=<branch_name> --staged --worktree -- <path_to_directory> | |
// git: Rename local branch | |
git branch -m <oldname> <newname> | |
// git: Rename remote branch | |
git push origin :old-name new-name | |
// git: search commit count across all branches, with period | |
git shortlog -s -e -n --all --since "20 Jun 2020 00:00:00" --before "21 Jun 2020 23:59:59" | |
// git: delete big file from git history | |
git clone --mirror [email protected]:<your repository> | |
alias bfg="java -jar /path/to/bfg-1.12.8.jar" | |
bfg --delete-files selenium-server-standalone-* <your repository>.git | |
cd <your repository>.git | |
git reflog expire --expire=now --all && git gc --prune=now --aggressive | |
gitk | |
git push | |
// ask everybody to update their repository | |
// git: reduce disk space, combined technique | |
git remote prune origin && git repack && git prune-packed && git reflog expire --expire=1.month.ago && git gc --aggressive | |
// git: ignore changes on certain files | |
git update-index --assume-unchanged <file1> <file2> <file3> | |
// To revert: | |
git update-index --no-assume-unchanged <file1> <file2> <file3> | |
// git: pick the difference between two branches as a commit | |
git checkout <branch where you want to commit> | |
git merge --squash <branch with more commits> | |
git commit | |
// gradle rerun tests | |
gradle --no-build-cache cleanTest test [-- tests *search*] | |
// Change node version | |
nvm ls | |
nvm use 12 | |
// Linux: change executable version | |
sudo update-alternatives --config php | |
// Ping with formatted timestamp | |
ping -O google.com | xargs -L 1 -I '{}' date '+%Y-%m-%d %H:%M:%S: {}' | |
// Much better than uname | |
neofetch | |
// If there's no neofetch | |
cat /etc/*-release | |
// Linux: list all processes listening to any port | |
sudo lsof -i -P -n | grep LISTEN | |
// List top 50 largest directory | |
sudo du -hc ~ | sort -rh | head -50 | |
// Darurat Internet: log connections | |
echo "" > /tmp/darurat.txt | |
echo "## SPEEDTEST ##" | tee -a /tmp/darurat.txt | |
speedtest | tee -a /tmp/darurat.txt | |
echo "" >> /tmp/darurat.txt | |
echo "## TRACEROUTE ##" | tee -a /tmp/darurat.txt | |
traceroute google.com | tee -a /tmp/darurat.txt | |
echo "" >> /tmp/darurat.txt | |
echo "## PING ##" | tee -a /tmp/darurat.txt | |
ping google.com -O -c 50 | tee -a /tmp/darurat.txt | |
echo "" >> /tmp/darurat.txt | |
sublime_text /tmp/darurat.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment