floatplane / git_pr Goto Github PK
View Code? Open in Web Editor NEWA command-line utility for creating, viewing, diffing, and merging GitHub pull requests
License: MIT License
A command-line utility for creating, viewing, diffing, and merging GitHub pull requests
License: MIT License
It’d be nice if git_pr left you on the same branch where you were when you invoked it.
ie. i’m on feature/a
and I perform git pr merge 123
(PR 123 corresponds to feature/a).
git pr
fails, ie.:
Local branch 'feature/syncPageAttributes' differs from remote branch 'charlesmchen/feature/syncPageAttributes'. Please reconcile before continuing.
the temptation is to git push -f since you think you are still on feature/a.
I always have to catch myself.
bug report:
peter [5:01 PM]
this is a new thing from `git-pr`
/Library/Ruby/Gems/2.0.0/gems/git-1.2.8/lib/git/diff.rb:121:in `split': invalid byte sequence in UTF-8 (ArgumentError)
from /Library/Ruby/Gems/2.0.0/gems/git-1.2.8/lib/git/diff.rb:121:in `process_full_diff'
from /Library/Ruby/Gems/2.0.0/gems/git-1.2.8/lib/git/diff.rb:107:in `process_full'
from /Library/Ruby/Gems/2.0.0/gems/git-1.2.8/lib/git/diff.rb:64:in `each'
from /Library/Ruby/Gems/2.0.0/gems/git_pr-0.0.13/lib/git_pr/merge.rb:55:in `any?'
from /Library/Ruby/Gems/2.0.0/gems/git_pr-0.0.13/lib/git_pr/merge.rb:55:in `merge_pull_cleanly'
from /Library/Ruby/Gems/2.0.0/gems/git_pr-0.0.13/bin/git-pr:217:in `<top (required)>'
from /usr/bin/git-pr:23:in `load'
from /usr/bin/git-pr:23:in `<main>'
[5:01]
when I run
~/gitclients/Paper (develop) $ git pr merge 4851
solution:
brian [8:58 AM]
ok so your git_pr deal was this: your branch was pretty diverged from origin/develop (a manual rebase would have made this go away). one of the files that was different in the branches was `lib/FiftyThreeSDK/docs/FiftyThree-Trademark-Guidelines/FiftyThree-Trademark-Guidlines.pdf`, which has embedded binary parts. somehow git didn't recognize it as binary, so `git diff` was printing binary data instead of just saying "Binary file changed"
[8:59]
now i know for next time.
peter [8:59 AM]
Hah
[9:00]
Odd - yeah that explains the gigantic binary thing that it spit out
The JIRA integration didn't work, and it causes @-mentioned people to get emailed twice.
like everything else does.
from @charlesmchen
Twice now I've had "git pr" fail with a message like this:
Local branch (feature/extractEntitlements) differs from remote branch (charlesmchen/feature/extractEntitlements). Please reconcile before continuing.
Since I started "git pr" while "feature/extractEntitlements" was the
current branch, I would respond (trying to resolve this issue) with:
git push -f
Of course, this was wrong - "git pr" had checked out "develop", so I
was now force-pushing develop. Dangerous! Both times, I was lucky
and had an up-to-date develop.
My request: "git pr" notes the current branch when it starts and if
there is an error, returns to that branch before exiting.
Problem seems to be that remote tracking branch for origin/develop is out of date.
Current branch is matthew/feature/syncActionCompositesRevisted
. Head of origin/develop is 32d4484
but we are diffing against 17bc0f8
instead.
$ git lol
* e324fc1 (HEAD, matthew/feature/syncActionCompositesRevisted) Clean up before PR.
* dd95c3a Avoid crashes in PageStorage.
* 2d5bd58 Lazy-generate image composites for sync operations and snapshots.
* 32d4484 Merge #5304 from DawnWright: Search space titles
|\
| * b91d2a7 Incorporate CR feedback from Bridger.
| * 9c42738 Update cell styling, remove subtitle.
| * 0c2e899 Slide top of header away & cancel in when searching
| * 926ece0 Refine search field behavior and add cancel.
| * ac248e7 Add search to the top-level navigation drawer.
|/
* 17bc0f8 (origin/develop, origin/HEAD, develop) Merge #5303 from bridger: Fix layout crash from PhotoView race. PPR-5544 #resolve
$ git pr -v dt 5307
Opening standard repository in /Users/brian/src/Paper
GitHub project: FiftyThree/Paper
Getting pull request information...
Executing git difftool 17bc0f8ec890853846de76033b942dfdf9607fff matthew/feature/syncActionCompositesRevisted
Maybe look at both upstream and origin and figure out which is a fork of the other...?
[10:46 AM] Peter Sibley: random git pr question, git pr list appears to work in one of my workspaces but not in another.
[10:46 AM] Peter Sibley: Are credentials stored in my home dir or in the repo?
[10:47 AM] Brian Sharon: in your home dir, but if it's not prompting you for credentials then it's not that
[10:47 AM] Peter Sibley: I tried doing gem upadte stuff
and still repros.
[10:47 AM] Peter Sibley: Is there a verbose mode or anything?
[10:47 AM] Brian Sharon: git pr -v list
[10:48 AM] Peter Sibley: ~/gitclients/Paper (develop) $ git pr -v list
No open pull requests found.
[10:48 AM] Brian Sharon: Also check the output of "git config --get pr.defaultremote" in both places
it's probably the upstream vs origin thing
[10:48 AM] Peter Sibley: yup that's it
[10:50 AM] Peter Sibley: OK that fixed it. Thanks.
[10:50 AM] Brian Sharon: cool. i wish i had a better heuristic for automatically determining the "root" repo
[10:51 AM] Peter Sibley: is upstream configured if so use the origin + upstream pattern
But agreed that it's confusing.
[10:52 AM] Brian Sharon: maybe i should check to see if upstream is a fork of origin or vice versa
/Users/brian/src/json_schema [floatplane-fix-test] $ git pr o
Specified remote 'origin' is not a GitHub remote.
/Users/brian/src/json_schema [floatplane-fix-test] $ git remote -v
floatplane [email protected]:floatplane/json_schema (fetch)
floatplane [email protected]:floatplane/json_schema (push)
origin https://github.com/brandur/json_schema (fetch)
origin https://github.com/brandur/json_schema (push)
Not sure why, "-v" prints nothing useful.
[email protected]: /Users/brian/src/Paper/iOS/ThirdParty/InAppSettingsKit [feature/fix-static-analyzer-bugs] $ git pr o
/Users/brian/.gem/ruby/2.0.0/gems/git-1.2.8/lib/git/lib.rb:342:in `chdir': Not a directory - /Users/brian/src/Paper/iOS/ThirdParty/InAppSettingsKit/.git (Errno::ENOTDIR)
from /Users/brian/.gem/ruby/2.0.0/gems/git-1.2.8/lib/git/lib.rb:342:in `config_get'
from /Users/brian/.gem/ruby/2.0.0/gems/git-1.2.8/lib/git/base.rb:137:in `config'
from /Library/Ruby/Gems/2.0.0/gems/git_pr-0.0.9.pre0/lib/git_pr/github.rb:85:in `determine_project_name_from_command_line'
from /Library/Ruby/Gems/2.0.0/gems/git_pr-0.0.9.pre0/bin/git-pr:196:in `<top (required)>'
from /usr/bin/git-pr:23:in `load'
from /usr/bin/git-pr:23:in `<main>'
request from julian
Explore +branchname
option and possibly --force-with-lease
Generated comment doesn't have the quotes escaped correctly. For a quick repro, put the word "don't" in a PR title.
If someone else pushes to the target branch before you do, you just get the following:
Verify that the merge looks clean:
* 5186863 (HEAD -> develop) Merge #5089 from floatplane: fix basic sync tests
|\
| * de0a939 (floatplane/feature/fix-basic-sync-tests, feature/fix-basic-sync-tests-rebase, feature/fix-basic-sync-tests) CR feedback
| * 0a27856 Fix BasicSampleClientLibTests to cope with latest server changes
|/
* a2da56e (origin/develop, origin/HEAD) Merge #5080 from mliberman: New Idea Button Refactor PPR-5156
Do you want to proceed with the merge (y/n)? y
Pushing changes to 'origin'
And then you're left with a merge commit that you have to unwind:
$ git lola
* 5186863 (develop) Merge #5089 from floatplane: fix basic sync tests
|\
| * de0a939 (HEAD -> feature/fix-basic-sync-tests, floatplane/feature/fix-basic-sync-tests) CR feedback
| * 0a27856 Fix BasicSampleClientLibTests to cope with latest server changes
|/
* a2da56e (origin/develop, origin/HEAD) Merge #5080 from mliberman: New Idea Button Refactor PPR-5156
$ git co develop
$ git reset --hard origin/develop
brian [12:51 PM]
ok, let's try this:
$ git for-each-ref --format='%(upstream:short)' refs/heads/feature/shapeSampleRate3
mattfeizli/feature/shapeSampleRate3
mattfeiszli [12:53 PM]
is that second line the output that you get, or is that part of the command?
brian [12:53 PM]
output
mattfeiszli [12:53 PM]
ok, i see this:
brian [12:53 PM]
but yours should say "matt"
mattfeiszli [12:53 PM]
~/gitclients/PaperSDKCore (feature/shapeSampleRate3) $ git for-each-ref --format='%(upstream:short)' refs/heads/feature/shapeSampleRate3
~/gitclients/PaperSDKCore (feature/shapeSampleRate3) $
brian [12:54 PM]
i don't think your branch has tracking info set. try this: `git push -u origin feature/shapeSampleRate3`
[12:54]
("-u" is shorthand for "--set-upstream-to")
mattfeiszli [12:54 PM]
should origin be matt given my setup?
brian [12:54 PM]
sorry, yes.
[12:55]
good catch :simple_smile:
mattfeiszli [12:55 PM]
no problem… Peter always complains about my backwards setup. :simple_smile:
brian [12:55 PM]
crazily enough, your setup is the same as mine...and i'm still messing up :simple_smile:
mattfeiszli [12:55 PM]
Ha!
[12:55]
~/gitclients/PaperSDKCore (feature/shapeSampleRate3) $ git push -u matt feature/shapeSampleRate3
Branch feature/shapeSampleRate3 set up to track remote branch feature/shapeSampleRate3 from matt by rebasing.
Everything up-to-date
brian [12:55 PM]
cool. now try `git pr o`
mattfeiszli [12:56 PM]
(2-factor auth delay… but it appears to be working…)
[12:56]
disco… that did it.
Example: Peter always wants to run git pr difftool $1 -- --dir-diff
for BeyondCompare.
a merge-aware version of git bisect
Example of ending up with junk:
$ git remote -v
FiftyThree [email protected]:FiftyThree/js2model.git (fetch)
FiftyThree [email protected]:FiftyThree/js2model.git (push)
origin [email protected]:FiftyThree/js2model (fetch)
origin [email protected]:FiftyThree/js2model (push)
FiftyThree
got added as part of a merge
call
First noticed by @dnkv when trying to merge into 'hotfix/2.0.2' branch
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.