What's wrong with just deleting the whole folder and clone repo and whatever branch you're interested in? In any case it's not an urgent thing. You don't have to do this mid-work, you can wait until you push most stuff and then rm && git clone. The only case in which this wouldn't work is when you have a ton of necessary local branches you can't even push to remote, which is a risk and anti-pattern per se.
because of my precious stash? but also the repo is huge, the clone takes 10 minutes? And all the other branches...
I found a useful Git one liner buried in leaked CIA developer docs
211–220 of 273 posts
Re: I found a useful Git one liner buried in leaked CIA developer docs
#212Re: I found a useful Git one liner buried in leaked CIA developer docs
#213so then it's `git ciaclean` and not bare `ciaclean` which imo is cleaner.
Re: I found a useful Git one liner buried in leaked CIA developer docs
#214Earlier quoted context omitted.
Also, git's "master" branch is named after a master recording or master copy, the canonical original from which duplicates are made. There is literally no reason for it be offensive except for those who retroactively associate the word with slavery.
I'll change my default branches to main when Masterclass change their name to Mainclass
Re: I found a useful Git one liner buried in leaked CIA developer docs
#215Beyond that, this is just OP learning how `xargs` works.
Re: I found a useful Git one liner buried in leaked CIA developer docs
#216Re: I found a useful Git one liner buried in leaked CIA developer docs
#217Earlier quoted context omitted.
How to list those? Is there a flag for git branch to sort by recently modified? (not on my computer right now to check)
I do `gb` (probably "git branch" when I set that up) which apparently is an alias to `git for-each-ref --sort=-committerdate refs/heads/ --format='%(refname:short)' | tac`, displays a list with the latest changed branch at the bottom. Remove the `| tac` for the reverse order.
git fetch --all --prune --quiet
git log origin/main --date=format:%m%d%H%M --pretty=format:'%C(yellow)%ad-%h%C(auto)%d %s (%cn)' -n1
git log --tags --date=format:%m%d%H%M --pretty=format:'%C(yellow)%ad-%h%C(auto)%d %s (%cn)' -n1
echo ''
git for-each-ref --count=10 --sort=-committerdate refs/heads/ --format='%(color:yellow)%(committerdate:format:%m%d%H%M)-%(objectname:short) (%(color:green)%(refname:short)%(color:yellow)) %(color:white)%(contents:subject) (%(authorname))'
I include a [month][day][hour][minute]-[git hash] prefix as enough info to see when branches were last updated and grab them when I make a mistake creating the branch from the wrong parent or want to cherry-pick.Re: I found a useful Git one liner buried in leaked CIA developer docs
#218Re: I found a useful Git one liner buried in leaked CIA developer docs
#219Re: I found a useful Git one liner buried in leaked CIA developer docs
#220https://gist.github.com/tomholford/0aa4cdb1340a9b5411ed6eaad...