Comments (10)
It seems that it is because the default branch is main
? There is a check in the cmd:
Either you can configure the default branch to master
, or the default branch detection is not correct.
from git-extras.
@spacewander I think it would be simple and effective to skip the deletion of branches with hardcoded values of master
, main
, trunk
, default
, development
, stable
, release
, and production
. I think that should detect 99% of cases, and will ignore some useful branches that may not be the default branch of any remote. To prevent confusion over the change of behavior, I think a warning should be emitted if we ignore a branch.
We can also read the config value for the default init branch and add that.
Indeed, I suggest the following approach
If there's a single remote use it
If multiple, only look up origin, then maybe upstream.
If not possible look at the existing init default branch
I agree with @spacewander, although it is a good heuristic, I think there is too much uncertainty around it and it will invariably do different things, even on the same computer. I for one, always use me
instead of origin
.
Another idea is to loop over all remotes, and add any of their default branches to the ignore list. I am not completely certain that it will not introduce many false positives.
from git-extras.
It seems the git_extra_default_branch
help function work by looking at configured values or environment variables, if none are present this function falls back to main
.
git-extras/helper/git-extra-utility
Lines 8 to 19 in 5f19424
from git-extras.
So you can configure the default branch to master
, if you are using it as the default branch.
from git-extras.
Yes but wouldn't that be better if git-extras discover this automatically, using the commands above ?
from git-extras.
Yes but wouldn't that be better if git-extras discover this automatically, using the commands above ?
Would you happen to have any suggestions? The git_extra_default_branch
is just reading the configured value.
from git-extras.
@spacewander Sorry for the late reply. Yes I think what I proposed in the top message could help resolve the default branch :
git rev-parse --abbrev-ref ${the_remote}/HEAD
from git-extras.
@spacewander Sorry for the late reply. Yes I think what I proposed in the top message could help resolve the default branch :
git rev-parse --abbrev-ref ${the_remote}/HEAD
Err... But there may be multiple remotes.
from git-extras.
Indeed, I suggest the following approach
- If there's a single remote use it
- If multiple, only look up
origin
, then maybeupstream
. - If not possible look at the existing init default branch
from git-extras.
Indeed, I suggest the following approach
- If there's a single remote use it
- If multiple, only look up
origin
, then maybeupstream
.- If not possible look at the existing init default branch
It seems too complex to me, which may introduce strange behavior. For example, the git-extras in my local machine has two remotes:
origin [email protected]:spacewander/git-extras (fetch)
origin [email protected]:spacewander/git-extras (push)
own [email protected]:tj/git-extras (fetch)
own [email protected]:tj/git-extras (push)
The origin
(https://github.com/spacewander/git-extras) 's default branch is master
, while the own
(https://github.com/tj/git-extras) 's default branch is main
.
The guess can't guarantee it's 100% correct.
@hyperupcall @vanpipy
What about your opinion?
from git-extras.
Related Issues (20)
- Unable to update on Windows HOT 9
- Test(git-authors): add unit test HOT 12
- Create destination folder during `git cp` if it doesn't exist HOT 1
- Allow override temp file location in `git cp` HOT 1
- `find` regex `-iregex '.*\(authors\|contributors\).*'` fails on BSDs
- Time to release 7.1.0 HOT 1
- Refactor(git-authors): support the option `--output` and controlled `--no-email` HOT 1
- Autocompletion after `brew install git-extras` HOT 7
- Discuss: add the python project attribute to git extras repository HOT 6
- git standup recursive search fails if -L missing HOT 1
- It's possible to set up autocompletion after brew install git-extras semi-automatically.
- New git-utimes is broken on Mac HOT 1
- Test(git-browse): unit tests
- Update account security
- Test(git-browse-ci): add unit tests
- Test(git-brv): add unit test
- Add a flag to "git delete-squashed-branches" to not abort on first error HOT 3
- Time to release 7.2.0 HOT 3
- [question/feature request] verbose repo summary HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from git-extras.