Skip to content

Instantly share code, notes, and snippets.

@KarllosSouza
Last active February 19, 2019 14:16
Show Gist options
  • Save KarllosSouza/63997b0a1991c8f15824 to your computer and use it in GitHub Desktop.
Save KarllosSouza/63997b0a1991c8f15824 to your computer and use it in GitHub Desktop.

Revisions

  1. KarllosSouza revised this gist Feb 19, 2019. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions git-commands.md
    Original file line number Diff line number Diff line change
    @@ -16,6 +16,8 @@ Undo the last commit, but leave the changes available: `git reset HEAD~ --soft`

    Revert file to origin branch's version: `git checkout origin/master file_name`

    Sync local branch with remote branch: `git fetch --all && git reset --hard origin/master`

    Change message of last commit: `git commit --amend -m "New message"`

    Visual representation of the branch merging into master: `git log --oneline --graph`
  2. KarllosSouza revised this gist Aug 6, 2018. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions git-commands.md
    Original file line number Diff line number Diff line change
    @@ -18,6 +18,8 @@ Revert file to origin branch's version: `git checkout origin/master file_name`

    Change message of last commit: `git commit --amend -m "New message"`

    Visual representation of the branch merging into master: `git log --oneline --graph`

    View unpushed git commits: `git log origin..`

    See previous git commands executed: `history | grep git`
  3. KarllosSouza revised this gist Oct 13, 2017. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions git-commands.md
    Original file line number Diff line number Diff line change
    @@ -10,9 +10,11 @@ Remove local branches which are no longer available on the remote: `git fetch -p

    Undo non-pushed commits: `git reset origin/master`

    Undo last commit: `git reset --hard HEAD~1`
    Undo the last commit: `git reset HEAD~ --hard`

    Revert file to origin branch's version: `git checkout origin/master file-name`
    Undo the last commit, but leave the changes available: `git reset HEAD~ --soft`

    Revert file to origin branch's version: `git checkout origin/master file_name`

    Change message of last commit: `git commit --amend -m "New message"`

  4. KarllosSouza revised this gist May 18, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-commands.md
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@ Undo non-pushed commits: `git reset origin/master`

    Undo last commit: `git reset --hard HEAD~1`

    Revert to origin/master branch's a version of file: `git checkout origin/master file-name`
    Revert file to origin branch's version: `git checkout origin/master file-name`

    Change message of last commit: `git commit --amend -m "New message"`

  5. KarllosSouza revised this gist May 18, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions git-commands.md
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,8 @@ Undo non-pushed commits: `git reset origin/master`

    Undo last commit: `git reset --hard HEAD~1`

    Revert to origin/master branch's a version of file: `git checkout origin/master file-name`

    Change message of last commit: `git commit --amend -m "New message"`

    View unpushed git commits: `git log origin..`
  6. KarllosSouza revised this gist Mar 23, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions git-commands.md
    Original file line number Diff line number Diff line change
    @@ -10,6 +10,8 @@ Remove local branches which are no longer available on the remote: `git fetch -p

    Undo non-pushed commits: `git reset origin/master`

    Undo last commit: `git reset --hard HEAD~1`

    Change message of last commit: `git commit --amend -m "New message"`

    View unpushed git commits: `git log origin..`
  7. KarllosSouza revised this gist Jan 3, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions git-commands.md
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,8 @@ Delete a local branch: `git branch -d branch-name`

    Delete a remote branch: `git branch -dr origin/branch-name`

    Remove local branches which are no longer available on the remote: `git fetch -p`

    Undo non-pushed commits: `git reset origin/master`

    Change message of last commit: `git commit --amend -m "New message"`
  8. KarllosSouza revised this gist Jul 7, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions git-commands.md
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,8 @@ Rename a local branch: `git branch -m branch-name`

    Delete a local branch: `git branch -d branch-name`

    Delete a remote branch: `git branch -dr origin/branch-name`

    Undo non-pushed commits: `git reset origin/master`

    Change message of last commit: `git commit --amend -m "New message"`
  9. KarllosSouza revised this gist May 31, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions git-commands.md
    Original file line number Diff line number Diff line change
    @@ -8,4 +8,6 @@ Undo non-pushed commits: `git reset origin/master`

    Change message of last commit: `git commit --amend -m "New message"`

    View unpushed git commits: `git log origin..`

    See previous git commands executed: `history | grep git`
  10. KarllosSouza created this gist Sep 18, 2015.
    11 changes: 11 additions & 0 deletions git-commands.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    # Git Commands

    Rename a local branch: `git branch -m branch-name`

    Delete a local branch: `git branch -d branch-name`

    Undo non-pushed commits: `git reset origin/master`

    Change message of last commit: `git commit --amend -m "New message"`

    See previous git commands executed: `history | grep git`