Git Cleanup Guide

Git Cleanup Guide

Written by Robert

πŸ“… 2024-08-28 | πŸš€ Galvanytics | 🏷️ Git

Table of Contents

TABLE OF CONTENTS

Step by Step Guide

List all local branches

...which are not part of the remote repo and perform action

git remote prune origin --dry-run
git remote prune origin

Remove all local branches

...which are not part of the remote repo and perform action

git-cleanup.sh
git fetch -p && git branch --merged | grep -v '*' | grep -v 'master' | xargs git branch -d

Merge branch into branch

(resolve conflicts)

git checkout <branch_to_merge>
git pull
git checkout <branch_to_merge_into>
git pull
git merge <branch_to_merge>