gawkworkflow: Repo Maintenance

1 
1 7 Keeping Your Repo Organized
1 *****************************
1 
1 There are a few commands you should know about to help keep your local
1 repo clean.
1 
1 _Removing old branches_
1      Developers add branches to the Savannah repo and when development
1      on them is done, they get merged into 'master'.  Then the branches
1      on Savannah are deleted (as shown in ⇒General practices).
1 
1      However, your local copies of those branches (labelled with the
1      'origin/' prefix) remain in your local repo.  If you don't need
1      them, then you can clean up your repo as follows.
1 
1      First, remove any related tracking branch you may have:
1 
1           $ git pull                                Get up to date
1           $ git branch -d feature/merged-feature    Remove tracking branch
1 
1      Then, ask Git to clean things up for you:
1 
1           $ git fetch --prune                       Remove unneeded branches
1 
1 _Removing cruft_
1      As Git works, occasional "cruft" collects in the repository.  Git
1      does occasionally clean this out on its own, but if you're
1      concerned about disk usage, you can do so yourself using 'git gc'
1      (short for "garbage collect").  For example:
1 
1           $ du -s .                               Check disk usage
1           -| 99188   .                            Almost 10 megabytes
1           $ git gc                                Collect garbage
1           -| Counting objects: 32114, done.
1           -| Delta compression using up to 4 threads.
1           -| Compressing objects: 100% (6370/6370), done.
1           -| Writing objects: 100% (32114/32114), done.
1           -| Total 32114 (delta 25655), reused 31525 (delta 25231)
1           $ du -s .                               Check disk usage again
1           -| 75168   .                            Down to 7 megabytes
1 
1 _Renaming branches_
1      Occasionally you may want to rename a branch.(1)  If your branch is
1      local and you are on it, us:
1 
1           $ git branch -m feature/NEW-NAME
1 
1      Otherwise, use:
1 
1           $ git branch -m feature/OLD-NAME feature/NEW-NAME
1 
1      You then need to fix the upstream repo.  This command does so,
1      using an older syntax to simultaneously delete the old name and
1      push the new name.  You should be on the new branch:
1 
1           $ git push origin :feature/OLD-NAME feature/NEW-NAME
1 
1           NOTE: It is the leading ':' in the first branch name that
1           causes Git to delete the old name in the upstream repo.  Don't
1           omit it!
1 
1      Finally, reset the upstream branch for the local branch with the
1      new name:
1 
1           $ git push -u origin feature/NEW-NAME
1 
1    ---------- Footnotes ----------
1 
1    (1) This discussion adopted from here
1 (https://multiplestates.wordpress.com/2015/02/05/rename-a-local-and-remote-branch-in-git).
1