From e185ed4448acc42fbe083f761839573b770d8434 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 26 Jul 2025 07:12:47 +0000 Subject: [PATCH] chore: force-generate all markdown files and README.md --- README.md | 62 +++++++++++++++++++ ...-clean-up-local-git-branches-powershell.md | 54 ++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 README.md create mode 100644 contents/view-and-clean-up-local-git-branches-powershell.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..866d7bc --- /dev/null +++ b/README.md @@ -0,0 +1,62 @@ +
+ banner +
+ +> [!IMPORTANT] +> If you find a useful GIT command - be sure to send a PR here as well :) +> Refer to [contribution format guide](./dev-docs/FORMAT.md) to send a PR. + +# Table of Contents + +- [Git Essentials & Hidden Gems](./contents/git-essentials-hidden-gems.md): Start here to discover commands that can improve your workflow and understanding of Git. + - [git maintenance start](./contents/git-maintenance-start.md): Runs a cronJob in background for the specified repo for periodic maintenance. + - [git request-pull](./contents/git-request-pull.md): Generate a request to pull changes into a repository. +- [Cleanup Branches Fast โšก](./contents/cleanup-branches-fast.md): Quickly view and clean up local branches using Bash or PowerShell, including removing branches whose remote is gone. + - [Delete Local Branches Whose Remote is Gone (Bash)](./contents/delete-local-branches-whose-remote-is-gone-bash.md): Delete all local branches whose remote counterpart has been deleted, using Bash. + - [Delete Local Branches Whose Remote is Gone (PowerShell)](./contents/delete-local-branches-whose-remote-is-gone-powershell.md): Delete all local branches whose remote counterpart has been deleted, using PowerShell. + - [View and Clean Up Local Git Branches (Bash)](./contents/view-and-clean-up-local-git-branches-bash.md): Scripts to view and clean up local branches using Bash. + - [View and Clean Up Local Git Branches (PowerShell)](./contents/view-and-clean-up-local-git-branches-powershell.md): Scripts to view and clean up local branches using PowerShell. +- [Git Command Reference (Full List)](./contents/git-command-reference-full-list.md): A comprehensive list of Git commands used in this project. + - [git init --bare](./contents/git-init-bare.md): Initialize a bare repository, typically used for remote repositories. + - [git clone --mirror ](./contents/git-clone-mirror-repository.md): Clone a repository in mirror mode, including all refs and branches. +- [Useful Rare Git Commands You Never Heard Of](./contents/useful-rare-git-commands-you-never-heard-of.md): A collection of lesser-known but powerful Git commands. + - [git replace ](./contents/git-replace-old-commit-new-commit.md): Temporarily substitute one commit for another. +- [How to Use git push --force-with-lease Safely](./contents/how-to-use-git-push-force-with-lease-safely.md): Safely force-push to a branch without overwriting others' work. +- [Past commits of a specific file](./contents/past-commits-of-a-specific-file.md): See all commits and changes for a specific file. + - [Show Commit History of a Specific File](./contents/show-commit-history-of-a-specific-file.md) + - [Show Detailed Commit History (With Changes)](./contents/show-detailed-commit-history-with-changes.md) + - [Show Commit History With Author and Date](./contents/show-commit-history-with-author-and-date.md) + - [See Who Last Modified Each Line (Blame)](./contents/see-who-last-modified-each-line-blame.md) +- [Git Clean: Remove Untracked Files and Directories](./contents/git-clean-remove-untracked-files-and-directories.md): Remove untracked files and directories from your repository. +- [How to Use git worktree Safely](./contents/how-to-use-git-worktree-safely.md): Work on multiple branches simultaneously without switching. + - [Check Existing Worktrees](./contents/check-existing-worktrees.md) + - [Create a New Worktree](./contents/create-a-new-worktree.md) + - [Remove a Worktree](./contents/remove-a-worktree.md) + - [Switch Between Worktrees](./contents/switch-between-worktrees.md) + - [Use Worktrees for Temporary Fixes](./contents/use-worktrees-for-temporary-fixes.md) + - [Flags and Their Uses](./contents/flags-and-their-uses.md) +- [Sharing Changes as Patch Files](./contents/sharing-changes-as-patch-files.md): Generate and share patch files for committed or uncommitted changes. + - [Create Patch from Last Commit(s)](./contents/create-patch-from-last-commit-s.md) + - [Apply Patch with Commit Metadata](./contents/apply-patch-with-commit-metadata.md) + - [Create Patch from Uncommitted Changes](./contents/create-patch-from-uncommitted-changes.md) + - [Apply Diff File](./contents/apply-diff-file.md) + - [Patch vs Diff: Quick Reference](./contents/patch-vs-diff-quick-reference.md) +- [Pull Changes of Specific Files from a Commit](./contents/pull-changes-of-specific-files-from-a-commit.md): Restore or pull changes for specific files from a past commit without reverting the entire commit. + + +## Contributors & Credits + +> [!NOTE] +> Want to contribute? Add yourself as a contributor or author by following the [Contribution Format Guide](./dev-docs/FORMAT.md) and submitting a Pull Request. + +#### [๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Contributors](./Contributors&Credits.md) + +A list of individuals who have contributed to this project. Add your name and link in [Contributors&Credits.md](./Contributors&Credits.md#contributors). + +#### [๐Ÿง‘โ€๐Ÿ’ป Credits & Authors](./Contributors&Credits.md#credits-authors) + +Acknowledgment of the original authors. Add your name or blog if you authored a command or section. + +#### [๐Ÿ“– References & Resources](./Contributors&Credits.md#references-resources) + +A collection of blogs, articles, and materials used to learn more about Git. Add your favorite resources! diff --git a/contents/view-and-clean-up-local-git-branches-powershell.md b/contents/view-and-clean-up-local-git-branches-powershell.md new file mode 100644 index 0000000..bce8cc4 --- /dev/null +++ b/contents/view-and-clean-up-local-git-branches-powershell.md @@ -0,0 +1,54 @@ +[โฌ…๏ธ Back to Cleanup Branches Fast โšก](./cleanup-branches-fast.md) + +[โฌ†๏ธ Previous Step: View and Clean Up Local Git Branches (Bash)](./view-and-clean-up-local-git-branches-bash.md) + +# View and Clean Up Local Git Branches (PowerShell) + + +![Category: Branch Management](https://img.shields.io/badge/Category-Branch%20Management-blue) +> Scripts to view and clean up local branches using PowerShell. + + +#### Examples +- **List local branches without a remote connection.** + + ```sh +git branch -vv | Select-String -NotMatch "origin/" + ``` +- **Delete local branches without remote tracking.** + + ```sh +git branch -vv | Select-String -NotMatch "origin/" | ForEach-Object { $branch = ($_ -split "\s+")[1]; git branch -D $branch } + ``` +- **List branches whose remote is gone.** + + ```sh +git branch -vv | Select-String 'gone' + ``` + + +#### Steps +1. List local branches. +2. Delete local branches without remote. +3. View branches with deleted remote. +4. Delete stale local branches. + + +#### Warnings +- โš ๏ธ Deleting branches is irreversible. Double-check before running destructive commands. + + +#### ProTips +> [!TIP] +> Use PowerShell's 'Select-String' for flexible filtering. + +> [!TIP] +> Automate cleanup with a script for regular maintenance. + + + +[โžก๏ธ Continue to Next Topic: Git Command Reference (Full List)](./git-command-reference-full-list.md) + +--- + +_Author: mike-rambil โ€ข Updated: 2024-06-10 โ€ข Tags: branches, cleanup, powershell_