banner 728x90

Faster PR Pulls with Git Aliasses

In Mobile Web Development 91 views
banner 728x90

I love the traditional GitHub workflow of receiving pull requests, pull the pull request down to test and add the pull request together. GitHub makes the first and third steps easy, but drawing pull requests from new contributors requires some standard work that annoys me …

… namely to navigate to their fork and copy the fork address so that I can do it:

git pull https://github.com/some-new-user/repo.git branch-name

And because you do not know whether the author will contribute more in the future, it makes no sense to add them as a remote control (via git remote add ) – you'll just get muddy your entry on distance.

After years of this irritating dance, I found the great git alias of TeamPorcupine to easily complete pull requests:

git config --global --add alias.pr & # 39 ;! f () ; f & # 39;

git config --global --add alias.pr-clean & # 39 ;! git checkout master; git for-each-ref refs / heads / pr / * - format = "% (refname)" | while reading ref; do branch = $ ; git branch -D $ branch; done & # 39;

The first alias above, git pr allows you to write a pull request with ID, with which you create a new branch:

~ / Projects / debugger.html (master) $ git pr 4862
From https://github.com/devtools-html/debugger.html
* [new ref] refs / pull / 4862 / head -> pr / 4862
Switched to branch & pr; 4862 & # 39;

~ / Projects / debugger.html (pr / 4862) $

The second alias, git pr-clean removes all branches made with git pr :

~ / Projects / debugger.html (pr / 4862) $ git pr-clean
Switched to branch & # 39; master & # 39;
Your office runs 190 laps before on & # 39; origin / master & # 39 ;.
(use "git push" to publish your local commits)
husky> npm run -s postcheckout (node ​​v8.5.0)

Removed branch pr / 4862 (was 10fe5049).
~ / Projects / debugger.html (master) $

Note: you must have a remote upstream pointing to the upstream repo.

I can not tell you how happy I am that I have this alias git alias, and how much a bonus the pr-clean alias is. Choosing PRs will go much faster and I can focus more on code and functional overview than process!


banner 728x90
author
Author: 
    Build a user settings store with AWS AppSync
    Build a user settings store with AWS AppSync
    Amazon Cognito Sync is a service that
    Synchronize user settings for Android with AWS AppSync
    Synchronize user settings for Android with AWS AppSync
    Amazon Cognito Sync is a service that
    Script & Style Show: Episode 10: Dojo
    Script & Style Show: Episode 10: Dojo
    In this episode welcome David and Todd

    Leave a reply "Faster PR Pulls with Git Aliasses"

    Must read×

    Top