arc90 / git-sweep Goto Github PK
View Code? Open in Web Editor NEWA command-line tool that helps you clean up Git branches that have been merged into master.
License: MIT License
A command-line tool that helps you clean up Git branches that have been merged into master.
License: MIT License
git-sweep just closed one of the active PRs we've had and deleted the branch the PR was going into. Is it possible to configure it in a way so this would not happen again? :)
My repo was created using GitHub for Mac using the default settings. When I git sweep cleanup
, it prompts me to authenticate every time it deletes a branch.
Instead of Tell everyone to run 'git fetch --prune' to sync with this remote.
it should say Tell everyone to run 'git fetch --prune' to sync git-sweep.
('basename' for remote uri) or at least
Tell everyone to run
git fetch --prune to sync https://github.com/arc90/git-sweep.git
(full remote uri).
Currently one should 'manually' add repo name when passing on message to 'others',
I get this error when running bootstrap.py
Traceback (most recent call last):
File "bootstrap.py", line 58, in
).read() in ez
File "", line 1
^
It looks like the links that the url requests are asking for may be dead.
I'm using git-sweep on a repo where my SSH key requires a password to use. When running git-sweep preview
I get the following error:
Fetching from the remote
Cmd('git') failed due to: exit code(128)
cmdline: git fetch -v origin
stderr: 'fatal: Could not read from remote repository.'
Operation name 'Updating references' unknown - skipping line 'remote: Updating references: 100% (1/1)'Operation name 'Updating references' unknown - skipping line 'remote: Updating references: 100% (1/1)' deleting advanced_search (done)
git clone https://github.com/emacs-mirror/emacs.git
cd emacs
git-sweep preview
... and wait for ??? I guess the emacs repo is too large for the git-sweep.
Some kind of progress indication would help.
I got an issue.
When two many people using the same repo.
But just yourself can delete the remote branch belongs to you.
So can I specify the username, or can this program continue to delete branch when got an persission deny about current one.
Delete these branches? (y/n) y
deleting p/wi_links (done)
deleting u/others/request/4187Cmd('git') failed due to: exit code(1)
cmdline: git push --porcelain origin :u/others/request/4187
stderr: 'error: failed to push some refs to '[email protected]/project.git''
this is because I have permission to p/wi_links, but don't have permission to u/others/....
But this program can not continue to delete the rest.
When I run the latest git-sweep on a large repo w/ python 3.6 and Windows 10 it freezes up and doesn't give any progress.
Bug: the freeze
Feature request: provide progress indicator
Command: git-sweep preview --master=dev
There is a chance that the local references to remote branches are out of date when git-sweep runs. This can cause it to identify branches for deletion that do not actually exist on the remote.
To fix this, I think the --prune
option should be used whenever git-sweep fetches from the remote.
I passed this to git sweep to see what I needed to clean up:
git-sweep preview --master prod
As a result, I got a list of branches, and at the end:
To delete them, run again with `git-sweep cleanup`
But that's not strictly correct, because I passed in the --master argument. I suspect we should either paraphrase here (just say "re-run with cleanup rather than preview" or something), or preserve all of the arguments passed in in the recommended command to run next.
Low priority, but I could envision some pretty bad results if people do the wrong thing here.
Hi,
I've noticed git-sweep ignores local branches when they don't match the remote branch name? I usually prefix remote pull branches with 'pull-*' to distinguish what branches to review.
Not sure yet how difficult this would be to implement, but at the very least to sweep local branches that have been merged into master.
I have tried git-sweep on a few of my larger repositories and I get an error but I'm not sure how to progress.
I see:
$ git sweep preview
Fetching from remote
len([huge array of stuff]) != len([another huge array])
and exit status is 1.
When I run git-sweep cleanup
, the branches to be cleaned up are listed then this:
Delete these branches? (y/n) name 'raw_input' is not defined
And nothing is cleaned up.
Why am I asking this? I personally don't want to wait months like in other PRs to get a reply neither I want to leave this PR open for years.
Not sure what the underlying issue is here (I'm not really a Python person), but following the install instructions for building from source ('python2.7 bootstrap.py') I get a failure.
Traceback (most recent call last):
File "bootstrap.py", line 105, in <module>
ws.find(pkg_resources.Requirement.parse(requirement)).location
AttributeError: 'NoneType' object has no attribute 'location
I believe the issue is that ws.find is failing to find whatever it's supposed to be finding, but that's about as far as I can get in debugging this myself.
git-sweep preview
Remote-Section has invalid format: 'remote'
Tried with 3 different repos after installing with pip.
It would be nice to have an --include flag, for those instances where what I want to exclude is larger than what I want to include.
With a repository that has already been cleaned up, running git-sweep on it again results in there being no branches available for cleanup. However, you are still prompted yes or no whether you wish to cleanup the branches.
Example output
No remote branches are available for cleaning up
Delete these branches? (y/n)
The tool works great to remove all merged branches, but sometimes I need to keep the merged branches for a short while, just in case I need to re-use one of them. A great feature would be to specify an "older than" date, then sweep only merged branches that were merged before that date.
λ git-sweep preview
Fetching from the remote
Cmd('git') failed due to: exit code(128)
cmdline: git fetch -v origin
stderr: 'fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.'
The problem is that the program is not showing prompt for SSH password input for access to private repository. I am only able to overcome it by using approach here https://superuser.com/a/1044918/732650
I get no branches returned after "Fetching from the remote" runs. No errors appear.
I guess that it's because i have hundreds of branches.
Are there anyone can help me?
When running git sweep cleanup --nofetch
with Python version 3.9.1 I get the following error:
Delete these branches? (y/n) name 'raw_input' is not defined
The command-line tool is organized by sub-commands. But it's unclear when you first try and use it that you must run git-sweep preview -h
or git-sweep cleanup -h
.
The help menu should be more helpful.
I noticed that you can only use this program if your remote is named origin. If you have multiple remotes or named your remote something else like 'github', the program will not run because it cannot find the origin remote. I would like for there to be an option to allow the user to select the remote name. Later on, I suggest a feature using an -allremotes option that will go through all the remotes and clean up the branches that may be on multiple remotes. It is very common for people to have a code base as a remote, a friend's computer as a remote and/or a live production system as a remote.
>>> git-sweep cleanup --origin=local
Could not find the remote named local
Not sure why it needs a remote named local, it should be able to tell if a branch is local or not without the user having to configure their remotes in a special way.
It would be nice to have --verbose option to debug things like issue #29
%> git-sweep preview
Fetching from the remote
len(["4897cbaf0adce62d5867b1d3ed81056d67298efe\t\tbranch 'develop' of git:client/iOS\n", "88b834aa286fe83b58aadaeabb5dbf6668a05de7\tnot-for-merge\tbranch 'katana' of git:client/iOS\n", "f11733b73ef6eb4a0186f9ed78df8877b7cf0eaf\tnot-for-merge\tbranch 'master' of git:client/iOS\n"]) != len(['X11 forwarding request failed on channel 0', '', ' = [up to date] develop -> origin/develop', ' = [up to date] katana -> origin/katana', ' = [up to date] master -> origin/master'])
This is using a git-flow configured repo.
Not sure what's relevant here, but here's my pip details
%> pip freeze
Fabric==1.5.3
GitPython==0.3.2.RC1
PyYAML==3.10
argcomplete==0.6.3
async==0.6.1
beautifulscraper==1.0.2
beautifulsoup4==4.1.3
boto==2.9.7
cram==0.6
demjson==1.6
docbook2epub==1.0.1dev
docutils==0.10
dumptruck==0.1.0
epubtools==1.0.0dev
git-sweep==0.1.1
gitdb==0.5.4
httplib2==0.7.7
ipython==0.13.1
kaptan==0.5.7
logilab-astng==0.24.1
logilab-common==0.59.0
lxml==2.3
mercurial==2.9
paramiko==1.9.0
pycrypto==2.6
pygraphviz==1.1
pylint==0.26.0
pysqlite==2.6.3
python-qt==0.50
readline==6.2.0
scraperwiki==0.2.0
simplejson==3.3.0
smmap==0.8.2
ssh==1.8.0
swampy==2.1.1
tmuxp==0.0.44
urlnorm==1.1.2
vboxapi==1.0
wsgiref==0.1.2
git-sweep cleanup --skip=master,release,staging --nofetch
Delete these branches? (y/n) y
deleting abctest'git push --porcelain origin :abctest' returned with exit code 1
What can I do to debug this further....any information I can provide?
It seems that this project is no longer maintained (looking at the comments in https://github.com/arc90/git-sweep/pull/43/files)
Would it be possible to tranfer the project to another group or org that can maintain, or simply give the commit bit to some additonal people?
I would gladly volunteer, git-sweep is awesome and I've been using it for several years 👍
Having an option to be able to specify which branches to skip based on a regular expression.
For example being able to skip any branch beginning with "release", rather than having to specify each branch individually.
A backup would be useful when a branch was deleted by accident among other branches. Something similar to:
cp .git/FETCH_HEAD .git/FETCH_HEAD.20140402135859.git_sweep
I am still figuring out the right reason for using the sweep functionality. Most of the VCS have search feature to search the branch and if branches are using some pattern, I don’t find urgent need to remove the branches created by others.
Could you also show the size I will save overall by deleting the branches, let’s say under preview
option?
Fetching from the remote
No remote branches are available for cleaning up
Delete these branches? (y/n)
Hi guys,
Could functionality be added to clean only your local branches and not remote ones? Or is it possible that I am using git-sweep incorrectly and that functionality is already there?
This would be super useful because I tend to forget to delete my local branches after merging them with master and end up with a huge list of branches that I need to check one at a time to see if it is safe to delete.
Thanks!
As mentioned in #44 - I have to reinstall the package. How to do it in safe way?
Hangs indefinitely. Is there a way to debug this?
Fetching from the remote
Traceback (most recent call last):
...
CommandLine(sys.argv).run()
File "C:\Python27\lib\site-packages\gitsweep\cli.py", line 89, in run
self._sweep()
File "C:\Python27\lib\site-packages\gitsweep\cli.py", line 126, in _sweep
ok_to_delete = inspector.merged_refs(skip=skips)
File "C:\Python27\lib\site-packages\gitsweep\inspector.py", line 37, in merged_refs
with_extended_output=True, with_exceptions=False)
File "C:\Python27\lib\site-packages\git\cmd.py", line 346, in execute
stdout_value, stderr_value = proc.communicate()
File "C:\Python27\lib\subprocess.py", line 799, in communicate
return self._communicate(input)
File "C:\Python27\lib\subprocess.py", line 1043, in _communicate
stdout_thread.join()
File "C:\Python27\lib\threading.py", line 949, in join
self.__block.wait()
File "C:\Python27\lib\threading.py", line 339, in wait
waiter.acquire()
File "C:\Python27\lib\site-packages\async\__init__.py", line 21, in thread_interrupt_handler
prev_handler(signum, frame)
KeyboardInterrupt
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.