Skip to content

Instantly share code, notes, and snippets.

@srikanthmanda
Last active May 22, 2021 15:20
Show Gist options
  • Save srikanthmanda/c74a85b457500063752e8332640aa103 to your computer and use it in GitHub Desktop.
Save srikanthmanda/c74a85b457500063752e8332640aa103 to your computer and use it in GitHub Desktop.

Revisions

  1. srikanthmanda revised this gist Nov 2, 2020. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion git-tips.md
    Original file line number Diff line number Diff line change
    @@ -28,7 +28,6 @@ git config author.email="[email protected]" # for use when author is a diff
    git config committer.name="John Doe" # for use when committer is a different user
    git config committer.email="[email protected] # for use when committer is a different user
    ```

    `GIT_AUTHOR_NAME`, `GIT_AUTHOR_EMAIL`, `GIT_COMMITTER_NAME`, `GIT_COMMITTER_EMAIL` and `EMAIL` environment variables override above settings.
  2. srikanthmanda revised this gist Nov 2, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-tips.md
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ git add forgotten_file edited_file ... # stage the changes to fix pre
    git commit --amend --no-edit # commit staged changes, without editing commit message
    git commit --amend -m "revised commit message" # edit commit message, and commits staged changes if any
    git commit --amend --reset-author # revise commit author info (for when done as wrong user)
    git commit --amend --reset-author # revise commit author info (for when committed as wrong user)
    ```

    ## Bypass Pre-commit Hooks
  3. srikanthmanda revised this gist Nov 2, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-tips.md
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@ git commit --amend --reset-author # revise commit author info (f
    ## Bypass Pre-commit Hooks

    ```
    git commit --no-verify # bypasses commit-msg hooks
    git commit --no-verify # bypasses commit-msg hooks too
    ```

    ## Configure User
  4. srikanthmanda revised this gist Nov 2, 2020. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions git-tips.md
    Original file line number Diff line number Diff line change
    @@ -20,14 +20,14 @@ git commit --no-verify # bypasses commit-msg hooks
    ## Configure User

    ```
    git config user.name="John Doe" # add --global flag for global configuration
    git config user.email="[email protected]" # add --global flag for global configuration
    git config user.name="John Doe" # add --global flag for global configuration
    git config user.email="[email protected]" # add --global flag for global configuration
    git config author.name="John Doe"
    git config author.email="[email protected]"
    git config author.name="John Doe" # for use when author is a different user
    git config author.email="[email protected]" # for use when author is a different user
    git config committer.name="John Doe"
    git config committer.email="[email protected]
    git config committer.name="John Doe" # for use when committer is a different user
    git config committer.email="[email protected] # for use when committer is a different user
    ```

  5. srikanthmanda revised this gist Nov 2, 2020. 1 changed file with 11 additions and 2 deletions.
    13 changes: 11 additions & 2 deletions git-tips.md
    Original file line number Diff line number Diff line change
    @@ -20,10 +20,19 @@ git commit --no-verify # bypasses commit-msg hooks
    ## Configure User

    ```
    git configure user.name="John Doe" # add --global flag for global configuration
    git configure user.email="[email protected]" # add --global flag for global configuration
    git config user.name="John Doe" # add --global flag for global configuration
    git config user.email="[email protected]" # add --global flag for global configuration
    git config author.name="John Doe"
    git config author.email="[email protected]"
    git config committer.name="John Doe"
    git config committer.email="[email protected]
    ```

    `GIT_AUTHOR_NAME`, `GIT_AUTHOR_EMAIL`, `GIT_COMMITTER_NAME`, `GIT_COMMITTER_EMAIL` and `EMAIL` environment variables override above settings.

    ## Undo a Commit

    - `revert` creates new commit(s) to undo commit(s).
  6. srikanthmanda revised this gist Nov 2, 2020. 1 changed file with 11 additions and 11 deletions.
    22 changes: 11 additions & 11 deletions git-tips.md
    Original file line number Diff line number Diff line change
    @@ -11,17 +11,6 @@ git commit --amend -m "revised commit message" # edit commit message, and com
    git commit --amend --reset-author # revise commit author info (for when done as wrong user)
    ```

    ## Undo a Commit

    - `revert` creates new commit(s) to undo commit(s).
    - `reset` discards a commit.

    Following command discards the last commit completely.

    ```
    git reset --hard HEAD~1
    ```

    ## Bypass Pre-commit Hooks

    ```
    @@ -34,3 +23,14 @@ git commit --no-verify # bypasses commit-msg hooks
    git configure user.name="John Doe" # add --global flag for global configuration
    git configure user.email="[email protected]" # add --global flag for global configuration
    ```

    ## Undo a Commit

    - `revert` creates new commit(s) to undo commit(s).
    - `reset` discards a commit.

    Following command discards the last commit completely.

    ```
    git reset --hard HEAD~1
    ```
  7. srikanthmanda revised this gist Nov 2, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-tips.md
    Original file line number Diff line number Diff line change
    @@ -33,4 +33,4 @@ git commit --no-verify # bypasses commit-msg hooks
    ```
    git configure user.name="John Doe" # add --global flag for global configuration
    git configure user.email="[email protected]" # add --global flag for global configuration
    ```
    ```
  8. srikanthmanda revised this gist Nov 2, 2020. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions git-tips.md
    Original file line number Diff line number Diff line change
    @@ -22,6 +22,12 @@ Following command discards the last commit completely.
    git reset --hard HEAD~1
    ```

    ## Bypass Pre-commit Hooks

    ```
    git commit --no-verify # bypasses commit-msg hooks
    ```

    ## Configure User

    ```
  9. srikanthmanda revised this gist Nov 2, 2020. 1 changed file with 9 additions and 4 deletions.
    13 changes: 9 additions & 4 deletions git-tips.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Git Tips

    ## Amending a Commit
    ## Amend a Commit

    ```
    git commit -a -m "wrong commit, needs changes" # commit only staged changes, miss untracked changes
    @@ -9,11 +9,9 @@ git commit --amend --no-edit # commit staged changes, witho
    git commit --amend -m "revised commit message" # edit commit message, and commits staged changes if any
    git commit --amend --reset-author # revise commit author info (for when done as wrong user)
    ```

    ## Undoing a Commit
    ## Undo a Commit

    - `revert` creates new commit(s) to undo commit(s).
    - `reset` discards a commit.
    @@ -23,3 +21,10 @@ Following command discards the last commit completely.
    ```
    git reset --hard HEAD~1
    ```

    ## Configure User

    ```
    git configure user.name="John Doe" # add --global flag for global configuration
    git configure user.email="[email protected]" # add --global flag for global configuration
    ```
  10. srikanthmanda revised this gist Nov 2, 2020. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions git-tips.md
    Original file line number Diff line number Diff line change
    @@ -9,6 +9,8 @@ git commit --amend --no-edit # commit staged changes, witho
    git commit --amend -m "revised commit message" # edit commit message, and commits staged changes if any
    git commit --amend --reset-author # revise commit author info (for when done as wrong user)
    ```

    ## Undoing a Commit
  11. srikanthmanda revised this gist Nov 2, 2020. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions git-tips.md
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,8 @@ git commit -a -m "wrong commit, needs changes" # commit only staged changes,
    git add forgotten_file edited_file ... # stage the changes to fix previous commit
    git commit --amend --no-edit # commit staged changes, without editing commit message
    git commit --amend -m "revised commit message" # edit commit message, and commits staged changes if any
    git commit --amend --reset-author # revise commit author info (for when done as wrong user)
    ```

    ## Undoing a Commit
  12. srikanthmanda revised this gist Nov 1, 2020. No changes.
  13. srikanthmanda revised this gist Nov 1, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-tips.md
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ git commit --amend -m "revised commit message" # edit commit message, and com

    ## Undoing a Commit

    - `revert` creates a new commit(s) to undo a commit.
    - `revert` creates new commit(s) to undo commit(s).
    - `reset` discards a commit.

    Following command discards the last commit completely.
  14. srikanthmanda revised this gist Nov 1, 2020. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion git-tips.md
    Original file line number Diff line number Diff line change
    @@ -14,6 +14,8 @@ git commit --amend -m "revised commit message" # edit commit message, and com
    - `revert` creates a new commit(s) to undo a commit.
    - `reset` discards a commit.

    Following command discards the last commit completely.

    ```
    git reset --hard HEAD~1
    ```
    ```
  15. srikanthmanda revised this gist Nov 1, 2020. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions git-tips.md
    Original file line number Diff line number Diff line change
    @@ -11,3 +11,9 @@ git commit --amend -m "revised commit message" # edit commit message, and com

    ## Undoing a Commit

    - `revert` creates a new commit(s) to undo a commit.
    - `reset` discards a commit.

    ```
    git reset --hard HEAD~1
    ```
  16. srikanthmanda revised this gist Nov 1, 2020. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions git-tips.md
    Original file line number Diff line number Diff line change
    @@ -8,3 +8,6 @@ git add forgotten_file edited_file ... # stage the changes to fix pre
    git commit --amend --no-edit # commit staged changes, without editing commit message
    git commit --amend -m "revised commit message" # edit commit message, and commits staged changes if any
    ```

    ## Undoing a Commit

  17. srikanthmanda revised this gist Nov 1, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-tips.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Git Tips

    ## Amending a commit
    ## Amending a Commit

    ```
    git commit -a -m "wrong commit, needs changes" # commit only staged changes, miss untracked changes
  18. srikanthmanda revised this gist Nov 1, 2020. No changes.
  19. srikanthmanda revised this gist Nov 1, 2020. No changes.
  20. srikanthmanda revised this gist Nov 1, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-tips.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    ## Amending a commit

    ```
    git commit -a -m "wrong commit, needs change" # both code and commit message can be amended
    git commit -a -m "wrong commit, needs changes" # commit only staged changes, miss untracked changes
    git add forgotten_file edited_file ... # stage the changes to fix previous commit
    git commit --amend --no-edit # commit staged changes, without editing commit message
    git commit --amend -m "revised commit message" # edit commit message, and commits staged changes if any
  21. srikanthmanda revised this gist Nov 1, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-tips.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    ## Amending a commit

    ```
    git commit -m "wrong commit, needs change" # both code and commit message can be amended
    git commit -a -m "wrong commit, needs change" # both code and commit message can be amended
    git add forgotten_file edited_file ... # stage the changes to fix previous commit
    git commit --amend --no-edit # commit staged changes, without editing commit message
    git commit --amend -m "revised commit message" # edit commit message, and commits staged changes if any
  22. srikanthmanda revised this gist Nov 1, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-tips.md
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,6 @@
    ```
    git commit -m "wrong commit, needs change" # both code and commit message can be amended
    git add forgotten_file edited_file ... # stage the changes to fix previous commit
    git commit --amend --no-edit # commit staged changes without editing commit message
    git commit --amend --no-edit # commit staged changes, without editing commit message
    git commit --amend -m "revised commit message" # edit commit message, and commits staged changes if any
    ```
  23. srikanthmanda revised this gist Nov 1, 2020. No changes.
  24. srikanthmanda renamed this gist Nov 1, 2020. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  25. srikanthmanda revised this gist Nov 1, 2020. No changes.
  26. srikanthmanda revised this gist Nov 1, 2020. No changes.
  27. srikanthmanda revised this gist Nov 1, 2020. No changes.
  28. srikanthmanda revised this gist Nov 1, 2020. No changes.
  29. srikanthmanda revised this gist Nov 1, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git.md
    Original file line number Diff line number Diff line change
    @@ -6,5 +6,5 @@
    git commit -m "wrong commit, needs change" # both code and commit message can be amended
    git add forgotten_file edited_file ... # stage the changes to fix previous commit
    git commit --amend --no-edit # commit staged changes without editing commit message
    git commit --amend -m "revised commit message" # commit with new message, and commits staged changes if any
    git commit --amend -m "revised commit message" # edit commit message, and commits staged changes if any
    ```
  30. srikanthmanda revised this gist Nov 1, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git.md
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,6 @@
    ```
    git commit -m "wrong commit, needs change" # both code and commit message can be amended
    git add forgotten_file edited_file ... # stage the changes to fix previous commit
    git commit --amend --no-edit # commit the staged changes without editing commit message
    git commit --amend --no-edit # commit staged changes without editing commit message
    git commit --amend -m "revised commit message" # commit with new message, and commits staged changes if any
    ```