![]() A few keystrokes (I use gitclean) and you've removed unnecessary local branches, cleaned up your list of remote branches, and get a look at the branches you're still working with. I like to run these steps as a TextExpander snippet. git branch -aĬombine all the things git remote prune origin -dry-run | sed -n -e 's/^.*origin\///p' | xargs git branch -d Revel in the clean, tidy list of branches you're now working with. If you want, take another look at your branches. Using the same git remote prune command, delete the references to the remote branches. > git remote prune origin -dry-run | sed -n -e 's/^.*origin\///p' | xargs git branch -d This runs the delete command once using each branch name. Pass your list of branches to the delete branch command ( git branch -d), using the pipe operator ( |) combined with the xargs command. Test the previous steps if you're not confident that you're deleting the branches you want to remove. Make sure you understand how this works before you use it. â ï¸ This will delete branches without asking you for confirmation. > git remote prune origin -dry-run | sed -n -e 's/^.*origin\///p' Take the output of the git remote prune command and trim off everything except the name of the branch, using the pipe operator ( |) and the sed command. The -dry-run option shows the branches that will be removed, but doesn't do it yet. List the branches on your remote repo (named origin) that have been merged with the primary branch (usually master) and deleted. There are multiple steps involved, so let's construct the full command one piece at a time. Remove the local branches that have already been merged on your remote repo. List your branchesÄ«efore you get started, look at the branches in your repo and make sure you have an idea which ones you're trying to delete. ![]() And now you have a branch or two that you're working on mixed in with branches that are no longer needed. So you've finished reviewing a bunch of work from your team and several new features have been merged to master and deployed.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |