Skip to content

Instantly share code, notes, and snippets.

@pavan538
Last active April 26, 2019 02:21
Show Gist options
  • Select an option

  • Save pavan538/438bf926b39906a5d3a8a39e58637b07 to your computer and use it in GitHub Desktop.

Select an option

Save pavan538/438bf926b39906a5d3a8a39e58637b07 to your computer and use it in GitHub Desktop.

Revisions

  1. pavan538 revised this gist Apr 26, 2019. 1 changed file with 14 additions and 1 deletion.
    15 changes: 14 additions & 1 deletion git_cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -13,4 +13,17 @@ Then:

    ```bash
    git commit -am "Remove ignored files"
    ```
    ```


    #### Googled : 3 ways of excluding files

    `.gitignore` applies to every clone of this repository (versioned, everyone will have it),

    `.git/info/exclude` only applies to your local copy of this repository (local, not shared with others),

    `~/.gitconfig` applies to all the repositories on your computer (local, not shared with others).

    actually requires to set a configuration on your computer :

    `git config --global core.excludesfile '~/.gitignore'`
  2. pavan538 created this gist Apr 18, 2019.
    16 changes: 16 additions & 0 deletions git_cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    #### Git untrack the file

    The series of commands below will remove all of the items from the Git Index (not from the working directory or local repo), and then updates the Git Index, while respecting git ignores. PS. Index = Cache

    First:

    ```bash
    git rm -r --cached .
    git add .
    ```

    Then:

    ```bash
    git commit -am "Remove ignored files"
    ```