Skip to content

Instantly share code, notes, and snippets.

@killerswan
Created April 1, 2017 15:02
Show Gist options
  • Save killerswan/7124e06d417ca47648d293ed6df8f825 to your computer and use it in GitHub Desktop.
Save killerswan/7124e06d417ca47648d293ed6df8f825 to your computer and use it in GitHub Desktop.
problem with git and GitHub fetching pull requests
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "kevin"]
url = git@github.com:killerswan/ponyc.git
fetch = +refs/heads/*:refs/remotes/kevin/*
[branch "master"]
remote = kevin
merge = refs/heads/master
[remote "upstream"]
url = git@github.com:ponylang/ponyc.git
fetch = +refs/heads/*:refs/remotes/upstream/*
fetch = +refs/pull/*:refs/remotes/upstream/pr/*
code $ git clone git@github.com:killerswan/ponyc.git --origin kevin
Cloning into 'ponyc'...
remote: Counting objects: 53628, done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 53628 (delta 10), reused 0 (delta 0), pack-reused 53596
Receiving objects: 100% (53628/53628), 24.29 MiB | 7.45 MiB/s, done.
Resolving deltas: 100% (33610/33610), done.
code $ cd ponyc
ponyc $ git remote -v && git remote add upstream git@github.com:ponylang/ponyc.git
...
ponyc $ git remote -v
kevin git@github.com:killerswan/ponyc.git (fetch)
kevin git@github.com:killerswan/ponyc.git (push)
upstream git@github.com:ponylang/ponyc.git (fetch)
upstream git@github.com:ponylang/ponyc.git (push)
ponyc $
ponyc $
ponyc $ git fetch kevin && git fetch upstream
remote: Counting objects: 175159, done.
remote: Total 175159 (delta 39327), reused 39327 (delta 39327), pack-reused 135832
Receiving objects: 100% (175159/175159), 113.02 MiB | 10.19 MiB/s, done.
Resolving deltas: 100% (89080/89080), completed with 343 local objects.
From github.com:ponylang/ponyc
* [new branch] MinGW64 -> upstream/MinGW64
* [new branch] adaptive-per-actor-scheduler-batch-sizes -> upstream/adaptive-per-actor-scheduler-batch-sizes
* [new branch] array-as-sequence -> upstream/array-as-sequence
* [new branch] assume-nominal -> upstream/assume-nominal
* [new branch] backpressure -> upstream/backpressure
* [new branch] baseline-prebuilt-binaries -> upstream/baseline-prebuilt-binaries
* [new branch] enhancement/autorecover-rhs -> upstream/enhancement/autorecover-rhs
* [new branch] enhancement/files-doc-string -> upstream/enhancement/files-doc-string
* [new branch] feature/exhaustive-match -> upstream/feature/exhaustive-match
* [new branch] fix/gencap-violation -> upstream/fix/gencap-violation
* [new branch] fix/reader-append-byteseq -> upstream/fix/reader-append-byteseq
* [new branch] get-or-else-perf -> upstream/get-or-else-perf
* [new branch] gh-pages -> upstream/gh-pages
* [new branch] how-to-pr -> upstream/how-to-pr
* [new branch] llvm-3.9.1 -> upstream/llvm-3.9.1
* [new branch] map-insert_if_absent -> upstream/map-insert_if_absent
* [new branch] master -> upstream/master
* [new branch] net-address-equality -> upstream/net-address-equality
* [new branch] pr/1227 -> upstream/pr/1227
* [new branch] refactor/add-refer-pass -> upstream/refactor/add-refer-pass
* [new branch] refactor/flatten-union-types-in-parser -> upstream/refactor/flatten-union-types-in-parser
* [new branch] refactor/reference-pass -> upstream/refactor/reference-pass
* [new branch] refactor/status-pass -> upstream/refactor/status-pass
* [new branch] release -> upstream/release
* [new branch] remove-union-check -> upstream/remove-union-check
* [new branch] rfc-41 -> upstream/rfc-41
* [new branch] sean-runtime-backpressure -> upstream/sean-runtime-backpressure
* [new branch] skip-ci-contributing -> upstream/skip-ci-contributing
* [new branch] skip-unneeded-ci-on-release -> upstream/skip-unneeded-ci-on-release
* [new branch] tcp-connection-dont-double-resubscribe -> upstream/tcp-connection-dont-double-resubscribe
* [new branch] tcp-one-shot-linux -> upstream/tcp-one-shot-linux
* [new branch] trace-when-freezing-on-send -> upstream/trace-when-freezing-on-send
* [new branch] update-api-docs-only-on-release -> upstream/update-api-docs-only-on-release
* [new branch] update-osx-from-source-instructions -> upstream/update-osx-from-source-instructions
* [new tag] 0.12.2 -> 0.12.2
* [new tag] 0.3.0 -> 0.3.0
* [new tag] 0.3.1 -> 0.3.1
* [new tag] 0.3.2 -> 0.3.2
* [new tag] 0.3.3 -> 0.3.3
* [new tag] 0.4.0 -> 0.4.0
* [new tag] 0.10.0 -> 0.10.0
* [new tag] 0.11.0 -> 0.11.0
* [new tag] 0.11.1 -> 0.11.1
* [new tag] 0.11.2 -> 0.11.2
* [new tag] 0.11.3 -> 0.11.3
* [new tag] 0.11.4 -> 0.11.4
* [new tag] 0.12.0 -> 0.12.0
* [new tag] 0.12.1 -> 0.12.1
* [new tag] 0.5.0 -> 0.5.0
* [new tag] 0.5.1 -> 0.5.1
* [new tag] 0.6.0 -> 0.6.0
* [new tag] 0.7.0 -> 0.7.0
* [new tag] 0.8.0 -> 0.8.0
* [new tag] 0.9.0 -> 0.9.0
ponyc $
ponyc $
ponyc $
ponyc $ gvim .git/config
ponyc $ git fetch upstream
remote: Counting objects: 4910, done.
remote: Compressing objects: 100% (47/47), done.
remote: Total 4910 (delta 3025), reused 3008 (delta 3008), pack-reused 1855
Receiving objects: 100% (4910/4910), 1.05 MiB | 0 bytes/s, done.
Resolving deltas: 100% (3234/3234), completed with 1458 local objects.
From github.com:ponylang/ponyc
* [new ref] refs/pull/1001/head -> upstream/pr/1001/head
* [new ref] refs/pull/1002/head -> upstream/pr/1002/head
* [new ref] refs/pull/1003/head -> upstream/pr/1003/head
...
* [new ref] refs/pull/1224/head -> upstream/pr/1224/head
* [new ref] refs/pull/1224/merge -> upstream/pr/1224/merge
* [new ref] refs/pull/1226/head -> upstream/pr/1226/head
* [new ref] refs/pull/1226/merge -> upstream/pr/1226/merge
error: cannot lock ref 'refs/remotes/upstream/pr/1227/head': 'refs/remotes/upstream/pr/1227' exists; cannot create 'refs/remotes/upstream/pr/1227/head'
! [new ref] refs/pull/1227/head -> upstream/pr/1227/head (unable to update local ref)
* [new ref] refs/pull/1228/head -> upstream/pr/1228/head
* [new ref] refs/pull/1229/head -> upstream/pr/1229/head
...
* [new ref] refs/pull/998/head -> upstream/pr/998/head
* [new ref] refs/pull/999/head -> upstream/pr/999/head
error: some local refs could not be updated; try running
'git remote prune upstream' to remove any old, conflicting branches
@killerswan
Copy link
Author

On a totally new clone, I add this to the .git/config:

fetch = +refs/pull/*:refs/remotes/upstream/pr/*

And then I can git fetch upstream to get the pull request head and merge branches from GitHub.... Except there's this problem locking the ref for 1227/head. Both in my old copy of the repo, and this new clone! 🙀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment