Skip to content

Commit 1a97486

Browse files
authored
Merge pull request #192 from lmarvaud/master
Add tips to delete local branches that has been squash and merged in the remote
2 parents 40b03da + 4f15d65 commit 1a97486

File tree

3 files changed

+384
-17
lines changed

3 files changed

+384
-17
lines changed

README.md

+22-15
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ P.S: All these commands are tested on `git version 2.7.4 (Apple Git-66)`.
7777
* [Rebases 'feature' to 'master' and merges it in to master ](#rebases-feature-to-master-and-merges-it-in-to-master)
7878
* [Archive the `master` branch](#archive-the-master-branch)
7979
* [Modify previous commit without modifying the commit message](#modify-previous-commit-without-modifying-the-commit-message)
80-
* [Prunes references to remote branches that have been deleted in the remote.](#prunes-references-to-remote-branches-that-have-been-deleted-in-the-remote)
80+
* [Prunes references to remove branches that have been deleted in the remote.](#prunes-references-to-remove-branches-that-have-been-deleted-in-the-remote)
81+
* [Delete local branches that has been squash and merged in the remote.](#delete-local-branches-that-has-been-squash-and-merged-in-the-remote)
8182
* [Retrieve the commit hash of the initial revision.](#retrieve-the-commit-hash-of-the-initial-revision)
8283
* [Visualize the version tree.](#visualize-the-version-tree)
8384
* [Visualize the tree including commits that are only referenced from reflogs](#visualize-the-tree-including-commits-that-are-only-referenced-from-reflogs)
@@ -442,7 +443,7 @@ git stash
442443

443444
__Alternatives:__
444445
```sh
445-
git stash save
446+
git stash push
446447
```
447448

448449
## Saving current state of unstaged changes to tracked files
@@ -458,7 +459,7 @@ git stash --keep-index
458459

459460

460461
```sh
461-
git stash save --keep-index
462+
git stash push --keep-index
462463
```
463464

464465
## Saving current state including untracked files
@@ -469,17 +470,23 @@ git stash -u
469470

470471
__Alternatives:__
471472
```sh
472-
git stash save -u
473+
git stash push -u
473474
```
474475

475476

476477
```sh
477-
git stash save --include-untracked
478+
git stash push --include-untracked
478479
```
479480

480481
## Saving current state with message
481482
```sh
482-
git stash save <message>
483+
git stash push -m <message>
484+
```
485+
486+
487+
__Alternatives:__
488+
```sh
489+
git stash push --message <message>
483490
```
484491

485492
## Saving current state of all files (ignored, untracked, and tracked)
@@ -495,7 +502,7 @@ git stash --all
495502

496503

497504
```sh
498-
git stash save --all
505+
git stash push --all
499506
```
500507

501508
## Show list of all saved stashes
@@ -645,7 +652,7 @@ git archive master --format=zip --output=master.zip
645652
git add --all && git commit --amend --no-edit
646653
```
647654

648-
## Prunes references to remote branches that have been deleted in the remote.
655+
## Prunes references to remove branches that have been deleted in the remote.
649656
```sh
650657
git fetch -p
651658
```
@@ -656,6 +663,11 @@ __Alternatives:__
656663
git remote prune origin
657664
```
658665

666+
## Delete local branches that has been squash and merged in the remote.
667+
```sh
668+
git branch -vv | grep ': gone]' | awk '{print <!-- @doxie.inject start -->}' | xargs git branch -D
669+
```
670+
659671
## Retrieve the commit hash of the initial revision.
660672
```sh
661673
git rev-list --reverse HEAD | head -1
@@ -1139,14 +1151,9 @@ git config [--global] --edit
11391151
git blame -L <start>,<end>
11401152
```
11411153

1142-
## List all Git variable.
1143-
```sh
1144-
git var -l
1145-
```
1146-
1147-
## Show a Git specific variable.
1154+
## Show a Git logical variable.
11481155
```sh
1149-
git var <variable>
1156+
git var -l | <variable>
11501157
```
11511158

11521159
## Preformatted patch file.

0 commit comments

Comments
 (0)