Senior DevOps Engineer with 11+ years of experience. Otherwise an avid artist, reader, cinephile & football fan. Looking forward to connecting with everyone :)
Oh man if I forgot to back up first...that would ruin so many things for me. We have a tendency to re-prioritize things so some branches are left half done for awhile, sometimes many months.
A handy one indeed @ben
. I went one step further and created an alias "git repo cleanup" in my ~/.bash_rc . Keeping a clean local is super helpful when projects get large and dozens of devs have you reviewing / checking / assisting daily.
It's generally not a good idea. If you finished working on a feature branch, merge it. If a branch isn't merged, it contains work in progress. Work in progress means something isn't working there. Also mass merging often leads to lots of conflicts.
Or better, delete everything merged into master, leaving out branches that can contain work in progress
I was waiting for instructions to
rm -frthe project and git clone it again 😉 this is much better!rm -rf is such a danger. I heard about how dangerous it is, but was oblivious to its power until I deleted a valuable folder!
And on Windows? 😢
PowerShell in Windows has slightly different syntax, but you can achieve the same result with the line below :)
Thanks, I should definitely look into Powershell a bit more (first time on a contract for a client with a Windows stack)
I mean, this is cool and all, but PS syntax is too explicit imo
Use Linux subsystem 😂
Blocked by the corporate proxy 😢😤
Wow that was perfect as I was deleting about multiple local branches manually!
Left with two and tried that one above and worked fabulously!
The feeling you've after the command finishes execution
PS: Don't forget to run
git checkout masterJust make sure to back up everything first :P
Oh man if I forgot to back up first...that would ruin so many things for me. We have a tendency to re-prioritize things so some branches are left half done for awhile, sometimes many months.
A handy one indeed @ben . I went one step further and created an alias "git repo cleanup" in my ~/.bash_rc . Keeping a clean local is super helpful when projects get large and dozens of devs have you reviewing / checking / assisting daily.
Is there any way to merge everything in master before deleting?
It's generally not a good idea. If you finished working on a feature branch, merge it. If a branch isn't merged, it contains work in progress. Work in progress means something isn't working there. Also mass merging often leads to lots of conflicts.
Oh thanks
I was just looking for something like this, thanks!
Here's one if you want to keep both
masteranddevelop:👌
This is awesome!!!