Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
300 views
in Technique[技术] by (71.8m points)

Git alias for clearing old branches is failing.. why?

Ive made a new git alias to clear out all my old unused git branches but its crashing my git config when i add it? I don't see why since it worked in my bash when i put it in earlier. Or I thought it did anyway!

clean-unused = "!git branch --merged | egrep -v "(^*|develop)" | xargs git branch -d"

Ive added the ! before the first git command as I understand this will open a new shell to run the command in.

What seems to be the problem here?

The crashing message from git: fatal: bad config line 11 in file /Users/<userName>/.gitconfig

question from:https://stackoverflow.com/questions/65890166/git-alias-for-clearing-old-branches-is-failing-why

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Escape inner double quotes and backslashes:

clean-unused = "!git branch --merged | egrep -v "(^\*|develop)" | xargs git branch -d"

Just tested, works for me.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...