{"id":18818155,"url":"https://github.com/helloimkevo/helpfulreferences","last_synced_at":"2026-05-01T18:32:03.722Z","repository":{"id":115878057,"uuid":"265873774","full_name":"HelloImKevo/HelpfulReferences","owner":"HelloImKevo","description":"A collection of helpful references ranging from git tips and tricks to shell scripting examples.","archived":false,"fork":false,"pushed_at":"2025-12-24T19:42:56.000Z","size":187,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-26T09:53:35.594Z","etag":null,"topics":["git","git-workflow","shell"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HelloImKevo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-05-21T14:44:41.000Z","updated_at":"2025-12-24T19:42:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"097087f7-146d-4ef3-bdc9-28a392769a7e","html_url":"https://github.com/HelloImKevo/HelpfulReferences","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/HelloImKevo/HelpfulReferences","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelloImKevo%2FHelpfulReferences","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelloImKevo%2FHelpfulReferences/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelloImKevo%2FHelpfulReferences/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelloImKevo%2FHelpfulReferences/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HelloImKevo","download_url":"https://codeload.github.com/HelloImKevo/HelpfulReferences/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelloImKevo%2FHelpfulReferences/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32508900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","git-workflow","shell"],"created_at":"2024-11-08T00:15:24.113Z","updated_at":"2026-05-01T18:32:03.706Z","avatar_url":"https://github.com/HelloImKevo.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Helpful References\nA collection of helpful references ranging from git tips and tricks to shell scripting examples.\n\n# Git Command References\n\n## Git Resources\nAn excellent, free, open-source difftool: **GitHub Desktop**  \nhttps://github.com/desktop/desktop\n\n## Git: CRUD (Create, Read, Update, Delete)\n```bash\n# Create a New Branch, based off Current Branch\ngit checkout -b \u003cname-of-new-branch\u003e\n\n# Create new remote branch\ngit checkout -b feature-branch-name\ngit push -u origin feature-branch-name\n\n# Delete a remote branch\ngit push origin --delete pr-merged-feature\ngit push origin :pr-merged-feature\n\n# Fetch remote branches and prune deleted remote branches\ngit fetch origin --prune\n```\n\n## Git: Standard Stuff\n```bash\n# Get current branch / changes status\ngit status\ngit log\ngit branch\n\n# Show remote URL / filepath\ngit remote show origin\ngit branch -a\ngit config -l\ngit branch --remote\n\n# Show all local branches with very verbose output, which includes\n# the associated remote origin branch, and whether it still exists.\ngit branch -vv\n\n# Checkout and pull an origin branch\ngit checkout develop \u0026\u0026 git pull\n\n# Synchronizing your Local Branch with a Source Branch\ngit checkout develop-my-feature \u0026\u0026 git rebase develop\n\n# Rebasing Dependent Branches using rebase onto\n# retrieve your old branch after committing... (noted in arcanist land output)\n# ex: git checkout -b dev-old-branch 622b869755986e198dfaac5534b6e7a7394f65a0\ngit checkout my-feature-branch\ngit rebase --onto dev-old-branch develop\n\n# Modifying your Local Branch\ngit add \u003cprojectdir/src/com/ui/SomeCoolActivity.java\u003e\ngit commit -a -m \"Custom Title Message\"\n\n# See how many lines of code you changed\ngit diff --shortstat\n\n# Showing file Differences between Branches\ngit diff --shortstat develop..master\ngit diff --name-status develop..master\n\n# Un-commit and stage changes from most recent commit\ngit reset --soft HEAD~1\n\n# Remove all Deleted files\ngit rm $(git ls-files --deleted)\n\n# Remove files marked as 'Deleted by them' during a nasty merge\ngit rm $(git diff --name-only --diff-filter=U)\n\n# Special git remove stuff\ngit rm -r directory_to_remove\ngit rm '*.txt' (Remove all text files)\ngit commit -m \"Message describing commit\"\n\n# Remove a GitIgnored File that is being Tracked\ngit rm -r --cached .\ngit add .\n\n# Restore the state of any file from a remote branch\ngit checkout origin/master /Users/person/GitProjects/app/Android/Activity.java\n```\n\n\n## Searching for Content with Git and macOS\n```bash\n# Search git history for a specific keyword\ngit log --all --grep='keyword'\n\n# Case insensitive search thru git history\n# returns 'Sugar', 'sugar', 'SUGAR', etc\ngit log --grep=\"Sugar\" -i\n\n# Search files within a macOS folder for a specific keyword\nfgrep -r \"\\\"Error\\\":\" ~/Downloads/LogFiles/\n```\n\n\n## Git: Re-Sync Local Branch with Existing Remote Branch\n```bash\n# Useful when you need to delete your local branch, create a new local\n# branch, and then point it to an existing remote branch.\ngit branch --set-upstream-to=origin/task/kevo/JIRA-123-Integrate-KMP-MTM-Client-Into-Core\n```\n\n\n## Git: The Stash\n```bash\n# Stash your local changes\ngit add .\ngit stash\ngit stash save \"temporarily add new bluetooth SDK v0.9.8\"\ngit stash apply stash^{/temporarily add}\ngit stash apply stash@{0}\n\n# Apply stashed changes \u0026 remove the stash\ngit stash pop stash@{5}\n\n# Delete a stash\ngit stash drop stash@{12}\n\n# Preview your stashed changes\ngit stash list\ngit stash show -p\ngit stash show -p stash@{2}\n\n# Roll back a local commit and put it in the stash, so it can\n# be applied to several branches.\ngit reset --soft HEAD~1\ngit add . \u0026\u0026 git stash save \"Changes I want to use on multiple branches\"\n```\n\n## Git: Config\n```bash\n# Check what the current remote repository URL is\ngit config --get remote.origin.url\n\n# Show your user email address for this specific repository\ngit config --get user.email\n\n# Set your user email address for this specific repository\ngit config user.email \"JohnSmith@gmail.com\"\n\n# List all git config settings\ngit config --list\n\n# List only the global git config settings\ngit config --global -l\n```\n\n## Git: Cool Tricks\n```bash\n# Count how many commits in a range\ngit rev-list newer_hash ^older_hash --count\n```\n\n\n## Git: Diff, Show \u0026 Log Tricks\n```bash\n# Show the list of files that were changed with the most recent commit in `HEAD`\ngit show --name-only --oneline HEAD\n```\n\n\n## Git: Logging and Viewing History\n```bash\n# Show commits by author before a specific date\ngit log --oneline -10 --author kevo --before \"Oct 30 2019\"\n\ngit log --oneline --graph --all --decorate --abbrev-commit\ngit log --oneline --decorate\ngit log develop --oneline --graph --decorate --abbrev-commit\ngit log feature-x --oneline --graph --decorate --abbrev-commit\ngit log release-pro-6.22.0 --oneline --graph --decorate --abbrev-commit\ngit log develop --pretty=format:'%C(yellow)%h;%Cred%ad;%Cblue%an;%Creset%s' --date=short | column -ts ';' | less -r\ngit log develop --author=\"Smith\" --pretty=format:'%C(yellow)%h;%Cred%ad;%Cblue%an;%Creset%s' --date=short | column -ts ';' | less -r\ngit log new-feature --author=\"John\" --pretty=format:'%C(yellow)%h;%Cred%ad;%Cblue%an;%Creset%s' --date=short | column -ts ';' | less -r\n\ngit log qa --oneline --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an : %Creset%s' --date=short f1cefdf9205f 3a8406a31b2c\ngit log --oneline --merges --all --decorate\ngit log qa --merges --pretty=format:'%C(yellow)%h;%Cred%ad;%Cblue%an;%Creset%s' --date=short | column -ts ';' | less -r\ngit log qa --oneline --graph --all --decorate --abbrev-commit --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an : %Creset%s' --date=short\n\n####################################################################\n# Formats the git log output to include the commit hash, the date,\n# author, and title, with the \"Bash Less\" navigation mechanism \n# (press 'q' to quit).\n#\n# See also: https://git-scm.com/docs/pretty-formats\n####################################################################\ngit log master --pretty=format:'%C(yellow)%h=%Cred%ad=%Cblue%an=%Creset%s' --date=short | column -ts '=' | less -r\n\n# Total changes for specific author\ngit log --author=\"_Your_Name_Here_\" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf \"added lines: %s, removed lines: %s, total lines: %s\\n\", add, subs, loc }' -\n\n# Rough estimate of contributions by all authors\ngit log --shortstat --pretty=\"%cE\" | sed 's/\\(.*\\)@.*/\\1/' | grep -v \"^$\" | awk 'BEGIN { line=\"\"; } !/^ / { if (line==\"\" || !match(line, $0)) {line = $0 \",\" line }} /^ / { print line \" # \" $0; line=\"\"}' | sort | sed -E 's/# //;s/ files? changed,//;s/([0-9]+) ([0-9]+ deletion)/\\1 0 insertions\\(+\\), \\2/;s/\\(\\+\\)$/\\(\\+\\), 0 deletions\\(-\\)/;s/insertions?\\(\\+\\), //;s/ deletions?\\(-\\)//' | awk 'BEGIN {name=\"\"; files=0; insertions=0; deletions=0;} {if ($1 != name \u0026\u0026 name != \"\") { print name \": \" files \" files changed, \" insertions \" insertions(+), \" deletions \" deletions(-), \" insertions-deletions \" net\"; files=0; insertions=0; deletions=0; name=$1; } name=$1; files+=$2; insertions+=$3; deletions+=$4} END {print name \": \" files \" files changed, \" insertions \" insertions(+), \" deletions \" deletions(-), \" insertions-deletions \" net\";}'\n```\n\n## Source Code Line Counts\n```bash\nwc -l `find app/src/ -type f -name \\*.kt -or -name \\*.java`\n```\n\n## Git: Live Dangerously\n```bash\n############################################\n#                                          #\n#  Merging / Rewriting Git Branch History  #\n#                                          #\n############################################\ngit checkout master\n\n# Use this when you know that all contents from source branch should be accepted.\ngit merge -X theirs develop\n\n# Checks any remaining differences from the branch, into the current branch.\ngit checkout develop .\n\n# If the previous step introduced more changes, usually they should be amended\n# to the \"merge\" commit (this keeps the history cleaner).\ngit commit --amend\n\n# Compares the branches; if there are differences, something went wrong.\n# The contents of the branches should be identical when merging down. \ngit difftool develop\n\n############################################\n#                                          #\n#  Force Push to Fix Broken Remote Branch  #\n#                                          #\n############################################\n# Force Push to Fix a Broken or Diverged Remote Branch\ngit checkout develop\n\n# Push your local branch to another local branch\ngit push --force . develop:stage\ngit checkout stage\n\n# Confirm that the branches are identical;\n# it is likely that the branch is diverged from origin.\ngit diff --shortstat develop..stage\n\n# This command requires repo \"Dangerous Change Protection\" to be disabled.\ngit push --force origin stage\n\n############################################\n#                                          #\n#       Permanently Erasing History        #\n#                                          #\n############################################\ngit checkout develop\ngit reset --hard 3cd5022c\n\n# Deletes the remote branch entirely\ngit push origin :develop\n\n# Pushes all commits in the life of the branch to the remote repo\ngit push origin develop\n```\n\n# Maintaining a Clean Git History\nOver the course of my career, I constantly refer to this 2014 writeup by Chris Beams that describes best practices for Git commits: https://chris.beams.io/posts/git-commit/  \n\n## Introduction: Why good commit messages matter\nIf you browse the log of any random Git repository, you will probably find its commit messages are more or less a mess. For example, take a look at these gems from my early days committing to Spring:\n```bash\n$ git log --oneline -5 --author cbeams --before \"Fri Mar 26 2009\"\n\ne5f4b49 Re-adding ConfigurationPostProcessorTests after its brief removal in r814. @Ignore-ing the testCglibClassesAreLoadedJustInTimeForEnhancement() method as it turns out this was one of the culprits in the recent build breakage. The classloader hacking causes subtle downstream effects, breaking unrelated tests. The test method is still useful, but should only be run on a manual basis to ensure CGLIB is not prematurely classloaded, and should not be run as part of the automated build.\n2db0f12 fixed two build-breaking issues: + reverted ClassMetadataReadingVisitor to revision 794 + eliminated ConfigurationPostProcessorTests until further investigation determines why it causes downstream tests to fail (such as the seemingly unrelated ClassPathXmlApplicationContextTests)\n147709f Tweaks to package-info.java files\n22b25e0 Consolidated Util and MutableAnnotationUtils classes into existing AsmUtils\n7f96f57 polishing\n```\n\nYikes. Compare that with these more recent commits from the same repository:\n```bash\n$ git log --oneline -5 --author pwebb --before \"Sat Aug 30 2014\"\n\n5ba3db6 Fix failing CompositePropertySourceTests\n84564a0 Rework @PropertySource early parsing logic\ne142fd1 Add tests for ImportSelector meta-data\n887815f Update docbook dependency and generate epub\nac8326d Polish mockito usage\n```\n\nWhich would you rather read?  \n\nThe former varies in length and form; the latter is concise and consistent.  \nThe former is what happens by default; the latter never happens by accident.  \n\n## The seven rules of a great Git commit message\n1. Separate subject from body with a blank line\n2. Limit the subject line to 50 characters\n3. Capitalize the subject line\n4. Do not end the subject line with a period\n5. Use the imperative mood in the subject line\n6. Wrap the body at 72 characters\n7. Use the body to explain what and why vs. how\n\nFor example:\n```\nSummarize changes in around 50 characters or less\n\nMore detailed explanatory text, if necessary. Wrap it to about 72\ncharacters or so. In some contexts, the first line is treated as the\nsubject of the commit and the rest of the text as the body. The\nblank line separating the summary from the body is critical (unless\nyou omit the body entirely); various tools like `log`, `shortlog`\nand `rebase` can get confused if you run the two together.\n\nExplain the problem that this commit is solving. Focus on why you\nare making this change as opposed to how (the code explains that).\nAre there side effects or other unintuitive consequences of this\nchange? Here's the place to explain them.\n\nFurther paragraphs come after blank lines.\n\n - Bullet points are okay, too\n\n - Typically a hyphen or asterisk is used for the bullet, preceded\n   by a single space, with blank lines in between, but conventions\n   vary here\n\nIf you use an issue tracker, put references to them at the bottom,\nlike this:\n\nResolves: #123\nSee also: #456, #789\n```\n\n# Examples of Well-Organized Git Repositories\n* Android mobile app with localized strings: https://github.com/google/iosched  \n* Complex, but well-organized: https://github.com/libra/libra  \n\n# Git Workflow: Forking \u0026 Pull Requests\n\n## GitHub Standard Fork \u0026 Pull Request Workflow  \n* Github pull request reviews documentation: https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-request-reviews  \n* Useful link about project forks: https://gist.github.com/Chaser324/ce0505fbed06b947d962  \n* Great YouTube video tutorial \"Creating a Simple Github Pull Request\" by Jake Vanderplas: https://www.youtube.com/watch?v=rgbCcBNZcdQ  \n\n```bash\n# Show which Git branches are tracking remote and upstream (source repo forked from)\ngit branch -vv\n\n# Keeping a fork up-to-date\ngit remote add upstream git://github.com/ORIGINAL-USERNAME/FORKED-PROJECT.git\ngit fetch upstream\ngit pull upstream master\n\n# List all remote pull requests\ngit ls-remote origin 'pull/*/head'\n\n# Fetch a specific pull request into a local branch and with a custom name\ngit fetch origin pull/50/head:pr-new-feature\n\n# Fetch a pull request from a fork repo and patch it as a local branch\ngit fetch git@github.com:username/ForkedProject.git refs/pull/50/head:pr-forked-feature\n```\n\n# Git Workflow: Mirror Copies of Repositories\n```bash\n# Initializing new local Repo on Windows file system\ncd ~/OneDrive/GitRepos\nmkdir NewProject\ncd NewProject\ngit init\ncd ~/GitProjects/\n\n# Note that this will automatically create the 'NewProject' Directory\ngit clone C:/Users/John/OneDrive/GitRepos/NewProject/.git\n```\n\n# Linux / Unix Utilities\n```bash\n# Show the differences between two files. Pipes indicate the lines are different.\ndiff -y -W 180 foo1.json foo2.json | less\n```\n\n# Android\n\n## JADX\njadx - Dex to Java decompiler: Command line and GUI tools for producing Java \nsource code from Android Dex and Apk files:  \nhttps://github.com/skylot/jadx  \n\n```shell\njadx-gui /Users/johnny/Documents/DecompilerSandbox/AndroidApp_4.1.0.apk\n```\n\n## Apktool\nReverse-engineering with Apktool:  \nhttps://apktool.org/  \nhttps://github.com/iBotPeaches/Apktool  \n\n```shell\njava -jar apktool_2.9.2.jar decode AndroidApp_4.1.0.apk\n\njava -jar apktool_2.9.2.jar build AndroidApp_4.1.0.apk\n```\n\nIt is a tool for reverse engineering 3rd party, closed, binary Android apps. \nIt can decode resources to nearly original form and rebuild them after making \nsome modifications; it makes possible to debug **smali** code step by step.\n\n## ProGuard\nYou can use `retrace.sh` from the Android SDK tools to use a mapping file\nto de-obfuscate a stack trace; example:\n```shell\n$ANDROID_SDK/tools/proguard/bin/\n\nretrace.sh mapping.txt stacktrace.txt\n```\n\n## Bugreport\nA bug report contains device logs, stack traces, and other diagnostic \ninformation to help you find and fix bugs in your app. To capture a bug report \nfrom your device, use the Take bug report developer option on the device, the \nAndroid Emulator menu, or the adb bugreport command on your development machine.  \nhttps://developer.android.com/studio/debug/bug-report\n```shell\n# MacOS\nadb bugreport ~/Desktop/galaxy-bugreport.zip\n\n# Windows\nadb bugreport C:\\Users\\johnny\\Desktop\\galaxy-bugreport.zip\n```\n\n## Scrcpy\nUsing the `-m` option usually fixes the \"green bars\" (screen burn-in) during\nrecording on some devices:\n```shell\nscrcpy -m 1280 --record ~/Desktop/my-recording.mp4\n```\n\nTo show Screen Taps during a demo recording, use the `--show-touches` arg:\n```shell\nscrcpy -m 1024 --show-touches --record ~/Desktop/my-recording-with-taps.mp4\n```\n\n### How to Grab a Screenshot from the Secondary Display\nYou can get the \"Display ID\" using:\n```shell\nadb shell dumpsys display\n```\nAnd then look for a display labeled like \"HDMI Screen\". The Display ID is the\nnumeric value of the `uniqueId` property in most cases:\n```\nDisplayDeviceInfo{\"HDMI Screen\": uniqueId=\"local:1\", 1280 x 800, modeId 2, \ndefaultModeId 2, supportedModes [{id=2, width=1280, height=800, fps=60.000004}], \ncolorMode 0, supportedColorModes [0], HdrCapabilities android.view.Display$HdrCapabilities@40f16308, \ndensity 237, 237.0 x 237.0 dpi, appVsyncOff 1000000, presDeadline 16666666, \ntouch EXTERNAL, rotation 0, type HDMI, address {port=1}, state ON, \nFLAG_SECURE, FLAG_SUPPORTS_PROTECTED_BUFFERS, FLAG_PRESENTATION}\n```\n\nThen you use the `-d` option in `adb shell screencap`:\n```shell\nadb shell screencap -d 1 /sdcard/screen-01.png \u0026\u0026 adb pull /sdcard/screen-01.png ~/Desktop/\n```\n\n\n# macOS Development\n\n## Installing NPM (Node Package Manager)\n```bash\narch -arm64 brew install npm\n```\n\nFor more details about NPM, see:  \nhttps://github.com/HelloImKevo/UdemyDatingApp?tab=readme-ov-file#angular-cli-initial-setup\n\n## Installing OpenUPM (Unity Package Manager)\n```bash\n# Install openupm-cli\nnpm install -g openupm-cli\n```\n\n\n## Convert Markdown to PDF\n\n```bash\n# Using Pandoc (most powerful)\npandoc README.md -o README.pdf\n\n# With better styling\npandoc README.md -o README.pdf --pdf-engine=wkhtmltopdf --css=style.css\n\n# Using md-to-pdf (Node.js)\nnpm install -g md-to-pdf\nmd-to-pdf README.md\n```\n\n### Online Converters\n\n- Markdown to PDF (https://md-to-pdf.fly.dev/)\n  - Simply paste your markdown content\n  - Instant conversion with good formatting\n\n- Dillinger (https://dillinger.io/)\n  - Live markdown editor with PDF export\n  - Preserves formatting well\n\n\n### IDE/Editor Extensions\n\n- VS Code: Markdown PDF extension\n- Typora: Built-in PDF export\n- Mark Text: Export to PDF option\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelloimkevo%2Fhelpfulreferences","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhelloimkevo%2Fhelpfulreferences","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelloimkevo%2Fhelpfulreferences/lists"}