Skip to content

Instantly share code, notes, and snippets.

@u01jmg3
Last active August 19, 2019 17:07
Show Gist options
  • Save u01jmg3/548ecef7ad4c3ca5f56a83ce56a8e681 to your computer and use it in GitHub Desktop.
Save u01jmg3/548ecef7ad4c3ca5f56a83ce56a8e681 to your computer and use it in GitHub Desktop.
Sourcetree Custom Actions
[alias]
cordova = "!f(){ MESSAGE=\"Build assets for deployment\"; [ \"$(git log -1 HEAD --pretty=format:%s)\" != \"$MESSAGE\" ] && git allclean && cordova prepare --release && git add -A && git commit -m \"$MESSAGE\" && git push || echo \"Commit already present\"; }; f"
fetch-pr = "!f(){ git fetch origin refs/pull/$1/head:pr/$1; }; f"
cleanup = !git clean -df
quick-clean = !git checkout . & git cleanup
all-clean = !git reset --hard && git cleanup
swap-last = !git tag _invert && git reset --hard HEAD~2 && git cherry-pick _invert _invert~1 && git tag -d _invert
invert-index = !git commit -m tmp1 && git add -A && git commit -m tmp2 && git swap-last && git reset HEAD~1 && git reset HEAD~1 --soft

%USERPROFILE%/.gitconfig

  1. Build Cordova for production

    git config --global push.default current
    
    git cordova
    
  2. Creates a local branch pr/? from the GitHub upstream (if it exists) or origin remote and checks it out

    git fetch-pr ?
    
    // git fetch-pr 100
    
  3. Add all uncommitted staged changes to the previous commit

    git commit --amend --no-edit
    
  4. Clean all unstaged changes

    git quick-clean
    
  5. Clean all staged and unstaged changes

    git all-clean
    
  6. Swap staged changes with unstaged changes and vice versa

    git invert-index
    
  7. Display a leaderboard of commits

    git shortlog -s -n --all
    
  8. Display today's commits

    git log --since="00:00:00" --no-merges --oneline --author=@gmail.com
    
  9. Display the current branches commits

    git log master.. --no-merges --pretty=format:%s
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment