mcasper / git-clean Goto Github PK
View Code? Open in Web Editor NEWA Command Line Tool written in Rust for cleaning up local and remote Git branches
License: MIT License
A Command Line Tool written in Rust for cleaning up local and remote Git branches
License: MIT License
I loved this tool for the first several usages. Then I recently ran into an issue where I accidentally lost some work since it was suggested to be deleted based on not being on the remote. I did not see the local only branch in the list to be deleted at the time.
The code here does this
Line 95 in c0f7369
I still think this is a great tool, just don't understand this choice. Sometimes I have work that I consider valuable but it is not pushed up to the remote yet.
Thankfully I was able to recover the commit via the reflog. It may be worth a note that users should push any local work up to remote to avoid losing it.
Cheers and thank you for this tool!
Dave
Sadness ensues as the branches build up.
It would be great to list certain branches as blacklisted for consideration. For example, we use a releases
branch on some repos that git-clean
wants to clean.
[vagrant@tyler current (master)]$ git-clean
The following branches will be deleted locally and remotely:
CBZ-100/CATS CBZ-427/project-add-person CBZ-466/tn/package_workflow_list CBZ-507/tn/meeting_open_items
CBZ-545/package_list_page_export_to_csv CBZ-546/tn/package_list_pdf CBZ-559/rfi-email-ux CBZ-562/tn/workflow_reset
CBZ-564/package-show-item-table-cleanup CBZ-576/submittal_package_numbering CBZ-604/tn/response_summary CBZ-628/add_bic_due_date
CBZ-655/std-bulk-add CBZ-683/tn/resque_stats CBZ-712/update_rfi_training_video CBZ-720/tn/std-add-person-notify
CBZ-756/tn/procurement_backend CBZ-774/procurement_fields_xml_generator CBZ-795/tn/failed_resque_stats CBZ-799/tn/submittal_pkg_approver_attachments
CBZ-857/tn/add_person_errors CBZ-889_fix_export_to_csv CBZ-911/tn/contact_active_history CBZ-923/pd-email-information
CBZ-930/tn/program_photo_logo CBZ-946/tn/reply_fallout CBZ-953/sequential-approver-bug SI-1444/tn/fixes_submittal_searching
ab/file_version_file_partial adl_bid_package_correspondence adl_company_directory_people_sort adl_directory_add_email_strip
ao/project_order ao/verizon_workflow bk/FIN-192/budget_import_bug bugsnag
cbz co/packages_list_sort_scope cron-basic-auth dev/cr_cbz_217
dev/cr_cbz_219 dev/cr_validating_project_number dev/js_bid_search_from_projects dev/js_documents_permission_count_inactive
dev/js_streaming_bid_doc_reminder_email dev/mp_sto_before_destroy_check_lit dev/nk_contact_login dev/nk_handle_msg_attachments
dev/rubytune_rails4 dev/tec_transmittals_pagination dev_ops/rpc_migration directory-cache
disable_draw_requests_button_upon_creation email-zion-style gb/observations-controllers mvc/meetings_race_condition
observations-mount-new package-review-followup package_review_page pm_sort_selectable_commitments
pmt/frontend_default_categories rubytune_paginate_submittal_packages std-user-popup-add-person tn/CBZ-446
tn/CBZ-454 tn/CBZ-513-transmittal_pdf tn/additional_attachments_on_multi_drawing_email tn/api_person_pickers
tn/autocomplete.js-tabs-to-spaces tn/bid_reminder_emails_bloat tn/binstubs tn/bulk_add
tn/bulk_add_autoselect_permission_template tn/bump_airbrake tn/bump_paranoia tn/bump_skylight
tn/cast_project_date_overrides tn/code_climate_formats tn/contract_sti tn/contract_string_validations
tn/cr_adl_company_directory_people_sort tn/cr_adl_directory_add_email_strip tn/cr_disable_draw_requests_button_upon_creation tn/custom_tool_overdue_emails
tn/databasedotcom tn/delayed_reports tn/dev/js_documents_permission_count_inactive_cr tn/directory_sample_data
tn/distributed_submittal_issues tn/distribution_validations tn/document_subscribers tn/document_subscribers_eager_load
tn/drawing_revision_api_performance tn/drop_not_null_from_workflow_transitions tn/executive_dashboard_filters tn/file_versions_pf_spec
tn/fix_intl_submittal_emails tn/fix_most_recent_folders tn/folder_img_path tn/folder_permissions
tn/hh2_spec_failure tn/hotfix_submittal_form_in_package tn/hotfix_submittal_packages tn/hotfix_update_vendor
tn/hyperlink_firefighting tn/hyperlink_firefighting2 tn/hyperlink_typo tn/ignore-paren-indentation
tn/improve_api_list_for_generic_tools tn/kennel_some_hounds tn/list_bounce_receipts tn/login_cleanup
tn/lower_logininformation_finds tn/master_structure tn/missing_workflow_stuff tn/new_memcache_servers
tn/newlines tn/package_final_due_date tn/package_workflow_demo tn/package_workflow_show
tn/package_workflow_update tn/pm_sort_selectable_commitments_cr tn/project_commitments_custom_form_editor tn/project_config_validations
tn/project_reports_code_climate tn/prostore_file_thumbnail_create tn/punch_item_position_search tn/punch_list_response_filter
tn/reconcile_wurlis_jit tn/remove_unused_var tn/remove_zenbox tn/rendering_views_without_a_controller
tn/resque_stats2 tn/resque_stats_frac_secs tn/rfi_order_dependent_test tn/rfi_responsible_contractor
tn/sequential_workflow_bugs tn/speed_up_carmen_pickers tn/stop_404ing tn/structure
tn/submittal_csv_due_date tn/submittal_distribution_triggers tn/submittal_form_due_date tn/submittal_imports
tn/submittal_package_ball_in_court tn/submittal_package_status tn/submittal_pdf_issues tn/submittal_pkg_spec_cleanup
tn/submittal_revisions tn/superuser_global_search tn/test_for_sub_pkg_dec tn/tincymce_blacklist_script
tn/totango_bulk_add tn/typeahead_fix tn/validate_rfi_position tn/vendor_merge_order_dependent_spec
tn/wf_gti_open_items tn/wf_spec_for_multiple_transitions tn/whitespace tn/workflow_order_dependent_failure
zg/CCM-293 zion-master
Continue? (Y/n)
Maybe my terminal settings are to blame?
it would be great to have an option to exclude specific branches. it would be even nicer to have a .git-clean
file or something to persist the configuration for the next run.
use-case here:
following the git-flow workflow, we have master & production as permanent branches that must not be deleted.
i have no experience with rust. i might take a peak though and see if i can patch it myself if this addition is welcome.
This is confusing:
$ git clean -h
usage: git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <paths>...
-q, --quiet do not print names of files removed
-n, --dry-run dry run
-f, --force force
-i, --interactive interactive cleaning
-d remove whole directories
-e, --exclude <pattern>
add <pattern> to ignore rules
-x remove ignored files, too
-X remove only ignored files
$ git-clean -h
Usage: git-clean [options]
Options:
-l, --locals only delete local branches
-r, --remotes only delete remote branches
-y, --yes skip the check for deleting branches
-s, --squashes check for squashes by finding branches incompatible
with master
-R, --remote REMOTE changes the git remote used (default is origin)
-b, --branch BRANCH changes the base for merged branches (default is
master)
-i, --ignore BRANCH ignores given branches
-h, --help print this help menu
-v, --version print the version
I'm attempting to install git-clean via a brew recipe that uses the release tarball. Any chance you could bump the latest release to 0.4.4?
We should have tests where we actually created a git repo (inside of the cargo target) and subshell out and interact with it. Currently we never actually execute the CLI in tests.
Hi @mcasper,
very nice crate ๐ช!
Is there a chance to support Windows too?
It compiles here but crashes when spawning into grep
.
If I find the extra time I could perhaps jump in if you wish.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.