Skip to content

Instantly share code, notes, and snippets.

@antespi
Last active December 26, 2015 07:19

Revisions

  1. antespi revised this gist Jul 26, 2015. 1 changed file with 9 additions and 6 deletions.
    15 changes: 9 additions & 6 deletions HowTo: Git discard changes.md
    Original file line number Diff line number Diff line change
    @@ -6,28 +6,31 @@ git stash save --keep-index
    ```

    Discard stash
    =============
    -------------

    ```
    git stash drop
    ```

    Apply stash
    ===========
    -----------

    ```
    git stash pop
    ```

    Discard changes done only in one file
    =====================================
    Discard changes
    ===============

    One file
    --------

    ```
    git checkout path/to/file/to/revert
    ```

    Discard changes done in all files
    =================================
    All files
    ---------

    ```
    git checkout -- .
  2. antespi revised this gist Jul 26, 2015. 1 changed file with 15 additions and 5 deletions.
    20 changes: 15 additions & 5 deletions HowTo: Git discard changes.md
    Original file line number Diff line number Diff line change
    @@ -1,25 +1,35 @@
    Save changes to stash
    =====================

    # git stash save --keep-index
    ```
    git stash save --keep-index
    ```

    Discard stash
    =============

    # git stash drop
    ```
    git stash drop
    ```

    Apply stash
    ===========

    # git stash pop
    ```
    git stash pop
    ```

    Discard changes done only in one file
    =====================================

    # git checkout path/to/file/to/revert
    ```
    git checkout path/to/file/to/revert
    ```

    Discard changes done in all files
    =================================

    # git checkout -- .
    ```
    git checkout -- .
    ```

  3. antespi renamed this gist Jul 26, 2015. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions HowTo: Git discard changes → HowTo: Git discard changes.md
    Original file line number Diff line number Diff line change
    @@ -8,6 +8,11 @@ Discard stash

    # git stash drop

    Apply stash
    ===========

    # git stash pop

    Discard changes done only in one file
    =====================================

  4. antespi created this gist Oct 23, 2013.
    20 changes: 20 additions & 0 deletions HowTo: Git discard changes
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    Save changes to stash
    =====================

    # git stash save --keep-index

    Discard stash
    =============

    # git stash drop

    Discard changes done only in one file
    =====================================

    # git checkout path/to/file/to/revert

    Discard changes done in all files
    =================================

    # git checkout -- .