Skip to content

Instantly share code, notes, and snippets.

@mitsuhiko
Last active January 30, 2021 20:22
Show Gist options
  • Save mitsuhiko/412f4aa1af6b590deb4b to your computer and use it in GitHub Desktop.
Save mitsuhiko/412f4aa1af6b590deb4b to your computer and use it in GitHub Desktop.

Revisions

  1. mitsuhiko revised this gist Jun 14, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    git addprx 42

    Adds pull request 42 as "pr/42" and rebases the changes against the current branch. What this means is that even if the pull request (of a bugfix was against master) it will now be rebased against the current branch (which could be the maintenance branch).
    Adds pull request 42 as branch "pr/42" and rebases the changes against the current branch. What this means is that even if the pull request (of a bugfix was against master) it will now be rebased against the current branch (which could be the maintenance branch).

    It also prints out a diffstat and all the commits with their new hashes at the end.

  2. mitsuhiko revised this gist Jun 14, 2014. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    ## How it works

    git addprx 42

    Adds pull request 42 as "pr/42" and rebases the changes against the current branch. What this means is that even if the pull request (of a bugfix was against master) it will now be rebased against the current branch (which could be the maintenance branch).

    It also prints out a diffstat and all the commits with their new hashes at the end.

    ![screenshot](http://i.imgur.com/aAvyiPF.png)
  3. mitsuhiko revised this gist Jun 14, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .gitconfig
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Alternatively don't use slog but something else. I just like that more.
    [aliases]
    slog = log --pretty=format:"%C(auto,yellow)%h%C(auto)%d\\ %C(auto,reset)%s\\ \\ [%C(auto,blue)%cn%C(auto,reset),\\ %C(auto,cyan)%ar%C(auto,reset)]"
    slog = log --pretty=format:"%C(auto,yellow)%h%C(auto)%d\\ %C(auto,reset)%s\\ \\ [%C(auto,blue)%cn%C(auto,reset),\\ %C(auto,cyan)%ar%C(auto,reset)]"
    addprx = "!f() { b=`git symbolic-ref -q --short HEAD` && \
    git fetch origin pull/$1/head:pr/$1 && \
    git fetch -f origin pull/$1/merge:PR_MERGE_HEAD && \
  4. mitsuhiko created this gist Jun 14, 2014.
    11 changes: 11 additions & 0 deletions .gitconfig
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    # Alternatively don't use slog but something else. I just like that more.
    [aliases]
    slog = log --pretty=format:"%C(auto,yellow)%h%C(auto)%d\\ %C(auto,reset)%s\\ \\ [%C(auto,blue)%cn%C(auto,reset),\\ %C(auto,cyan)%ar%C(auto,reset)]"
    addprx = "!f() { b=`git symbolic-ref -q --short HEAD` && \
    git fetch origin pull/$1/head:pr/$1 && \
    git fetch -f origin pull/$1/merge:PR_MERGE_HEAD && \
    git rebase --onto $b PR_MERGE_HEAD^ pr/$1 && \
    git branch -D PR_MERGE_HEAD && \
    git checkout $b && echo && \
    git diff --stat $b..pr/$1 && echo && \
    git slog $b..pr/$1; }; f"