Today I Learned

4 posts by dawidpośliński

Revert^2

In the given scenario:

  1. Pull request was merged
  2. The connected branch#1 was removed
  3. Merged PR was reverted
  4. You don’t have branch#1, but you can see the reverted commit#1

All you have to do is to track the commit#1 and revert reverted commit.

$ git revert commit#1

Clean up local list of your git branches

Have you ever had to search through a long list of local branches, which are mostly obsolete for you?

To keep your local git repository slim and avoid a long list of branches while doing git branch, there is an easy strategy that can save you a bit of time.

First, always remember to push everything you did to the remote when you leave a desk, then just run in the console:

git branch | grep -v "master" | xargs git branch -D

It will remove all your local branches except master. If you need to restore any particular branch, you can fetch and checkout - it will wait for you on your remote!

Remove Docker containers/cache

docker system prune -a -f

WARNING! This will remove:
        - all stopped containers
        - all networks not used by at least one container
        - all dangling images
        - all build cache
Deleted Containers:
364bf6faea40cbb733f7fe71d4e6634115c091cf60bba0c3432f0675c4c19026
1b6c011fab7492f5f0f5fd81b23dc71c020524e369f3e04d1da7a6fdfbafdba7
8fd3ce7b846e2927e952378ac763aff2d7e96881e8fb3bf352d014764bbd7625
885c3efd8b6096af8c7227174462972a93d46666f5d1a5b01339b77b2a868baf
ea60a832bc8445da22fa6c460cfa9dc816843fa7176e73c96d6de62f3048ed2d
e96ac95f80f53727e51f313946184db7d768c57808b12dd6f4f69edf038f7c74
54967f9c6c2e74314441d07e26ac4dc0b38ba53a2d2b665ab9c9be9f8d369def
3841b5d1586db0a7b500a3fc3cf54f3628f23b5236c161a1fee2a3a80b4f5cb7

Total reclaimed space: 14.83GB