Skip to content

Instantly share code, notes, and snippets.

@lmiceli
Last active March 10, 2017 11:17
Show Gist options
  • Select an option

  • Save lmiceli/d15f90816a0e430a800c733e770ae05d to your computer and use it in GitHub Desktop.

Select an option

Save lmiceli/d15f90816a0e430a800c733e770ae05d to your computer and use it in GitHub Desktop.

Revisions

  1. lmiceli renamed this gist Mar 10, 2017. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion git aliases → ...liases (.gitconfig en mi home de windows)
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    [alias]
    ll = log --graph --all --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(white)- %an, %ar%Creset'

    # one-line log
    @@ -48,4 +49,4 @@
    # Reverse the above
    unassume = update-index --no-assume-unchanged
    # Show the files that are currently assume-unchanged
    assumed = "!git ls-files -v | grep ^h | cut -c 3-"
    assumed = "!git ls-files -v | grep ^h | cut -c 3-"
  2. lmiceli revised this gist Oct 7, 2016. 1 changed file with 17 additions and 3 deletions.
    20 changes: 17 additions & 3 deletions git aliases
    Original file line number Diff line number Diff line change
    @@ -32,6 +32,20 @@
    publish = "!git push -u origin $(git branch-name)"
    # Delete the remote version of the current branch
    unpublish = "!git push origin :$(git branch-name)"
    # Delete a branch and recreate it from master — useful if you have, say,
    # a development branch and a master branch and they could conceivably go
    # out of sync

    # Working with files
    #

    # Unstage any files that have been added to the staging area
    unstage = reset HEAD
    # Show changes that have been staged
    diffc = diff --cached

    # Mark a file as "assume unchanged", which means that Git will treat it
    # as though there are no changes to it even if there are. Useful for
    # temporary changes to tracked files
    assume = update-index --assume-unchanged
    # Reverse the above
    unassume = update-index --no-assume-unchanged
    # Show the files that are currently assume-unchanged
    assumed = "!git ls-files -v | grep ^h | cut -c 3-"
  3. lmiceli revised this gist Oct 7, 2016. 1 changed file with 13 additions and 1 deletion.
    14 changes: 13 additions & 1 deletion git aliases
    Original file line number Diff line number Diff line change
    @@ -22,4 +22,16 @@
    b = "!git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'"

    # list aliases
    la = "!git config -l | grep alias | cut -c 7-"
    la = "!git config -l | grep alias | cut -c 7-"

    # Get the current branch name (not so useful in itself, but used in
    # other aliases)
    branch-name = "!git rev-parse --abbrev-ref HEAD"
    # Push the current branch to the remote "origin", and set it to track
    # the upstream branch
    publish = "!git push -u origin $(git branch-name)"
    # Delete the remote version of the current branch
    unpublish = "!git push origin :$(git branch-name)"
    # Delete a branch and recreate it from master — useful if you have, say,
    # a development branch and a master branch and they could conceivably go
    # out of sync
  4. lmiceli created this gist Oct 6, 2016.
    25 changes: 25 additions & 0 deletions git aliases
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    ll = log --graph --all --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(white)- %an, %ar%Creset'

    # one-line log
    l = log --pretty=format:"%C(#b6b649)%h\\ %ad%C(#f5236c)%d\\ %Creset%s%C(#0383f5)\\ [%cn]" --decorate --date=short

    a = add
    ap = add -p
    c = commit --verbose
    ca = commit -a --verbose
    cm = commit -m
    cam = commit -a -m
    m = commit --amend --verbose

    d = diff
    ds = diff --stat
    dc = diff --cached

    s = status -s
    co = checkout
    cob = checkout -b
    # list branches sorted by last modified
    b = "!git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'"

    # list aliases
    la = "!git config -l | grep alias | cut -c 7-"