[git-users] Help with git pull, and restricting what gets pulled

2017-04-26 Thread Michael
So I'm having a "too much pulled" issue, that I'd like help with.

I'm working with this remote:

[remote "origin"]
url = https://github.com/rg3/youtube-dl.git
fetch = +refs/heads/*:refs/remotes/origin/*


I wanted to be able to get pull requests to test and play with, and I was told 
to add this line:

fetch = +refs/pull/*/head:refs/remotes/origin/pr/*

Which worked -- I was able to say
  843  git fetch origin refs/pull/12121/head

No problem.

What was the problem? Doing an update.

keybounceMBP:youtube-dl michael$ git pull master
fatal: 'master' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
keybounceMBP:youtube-dl michael$ git pull
remote: Counting objects: 17909, done.
remote: Compressing objects: 100% (112/112), done.
remote: Total 17909 (delta 10124), reused 10079 (delta 10078), pack-reused 7717
Receiving objects: 100% (17909/17909), 74.44 MiB | 3.01 MiB/s, done.
Resolving deltas: 100% (12988/12988), completed with 3257 local objects.
>From https://github.com/rg3/youtube-dl
   629dc1892..b876a9cd7  gh-pages -> origin/gh-pages
   a4d6cf970..3dc8b61b7  master   -> origin/master
 * [new ref] refs/pull/0/head -> origin/pr/0
 * [new ref] refs/pull/100/head   -> origin/pr/100
 * [new ref] refs/pull/10011/head -> origin/pr/10011
 * [new ref] refs/pull/10012/head -> origin/pr/10012
...

So, instead of updating master, like I thought, or just the one pull request I 
had previously gotten (NB: those would be the only refs I had from that 
github), I now have lots and lots of things I don't care about or want.

My first question is, if I just delete the files from 
.git/refs/remotes/origin/pr/ that I don't want, will that result in git 
cleaning up the unwanted branches?

My second question is: The only way I could manage to update master was:

keybounceMBP:youtube-dl michael$ git fetch origin master
>From https://github.com/rg3/youtube-dl
 * branchmaster -> FETCH_HEAD
keybounceMBP:youtube-dl michael$ git checkout master
Switched to branch 'master'
Your branch is behind 'origin/master' by 12 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)
keybounceMBP:youtube-dl michael$ git pull
Updating a4d6cf970..3dc8b61b7
Fast-forward
 .github/ISSUE_TEMPLATE.md |   6 ++---

...

So, what is the proper/best usage of fetch/pull? At the moment, I'm interested 
in these branches:
origin master
origin refs/pull/12121
gkoelln Dish

And, while I did explicitly ask for pull request 12121, it did not show up in 
my remotes --
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "Dish"]
remote = gkoelln
merge = refs/heads/Dish

so what do I need to do to tell git that this is something I'm interested in?

(I can be 99% certain that I'll be adding some other pull request to this 
octopus at some point :-)

---
Entertaining minecraft videos
http://YouTube.com/keybounce

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[git-users] Re: Help with git pull, and restricting what gets pulled

2017-04-26 Thread Igor Djordjevic
Hi Michael,

On Wednesday, April 26, 2017 at 7:31:53 PM UTC+2, Michael Gersten wrote:
>
> So I'm having a "too much pulled" issue, that I'd like help with. 
>
> I'm working with this remote: 
>
> [remote "origin"] 
> url = https://github.com/rg3/youtube-dl.git 
> fetch = +refs/heads/*:refs/remotes/origin/* 
>
>
> I wanted to be able to get pull requests to test and play with, and I was 
> told to add this line: 
>
> fetch = +refs/pull/*/head:refs/remotes/origin/pr/* 
>

By doing this you explicitly said you want *all* pull requests (notice the 
* signs in there). If you wanted to have a specific one updated each time 
you do plain `git fetch`, you may have done it like this instead:

(*1*) fetch = +refs/pull/12121/head:refs/remotes/origin/pr/12121
 
... (notice using specific pull request id, in this case 12121, instead of 
*).


Which worked -- I was able to say 
>   843  git fetch origin refs/pull/12121/head 
>

If you wanted to fetch like this, you don`t need the above mentioned 
.config edit, just that it fetches to FETCH_HEAD, you don`t get a branch 
automatically.

If you want to fetch into a branch, you can do it like this:

(*2*) git fetch origin pull//head:

You can even simulate the remote branch by doing something like this:

(*3*) git fetch origin pull/12121/head:refs/remotes/origin/pr/12121

... or if you edited .config as described in (*1*), you can just do `git 
fetch`, without additional parameters.

To create a local remote tracking branch out of it:

(*4*) git checkout -b pull/12121 --track origin/pr/12121

 

> No problem. 
>
> What was the problem? Doing an update. 
>
> keybounceMBP:youtube-dl michael$ git pull master 
> fatal: 'master' does not appear to be a git repository 
> fatal: Could not read from remote repository. 
>
> Please make sure you have the correct access rights 
> and the repository exists. 
>

Here, you are using `git pull` with a wrong parameter, providing it a 
branch name, where it`s expecting a remote name first (see git-pull[1] 
).


keybounceMBP:youtube-dl michael$ git pull 
> remote: Counting objects: 17909, done. 
> remote: Compressing objects: 100% (112/112), done. 
> remote: Total 17909 (delta 10124), reused 10079 (delta 10078), pack-reused 
> 7717 
> Receiving objects: 100% (17909/17909), 74.44 MiB | 3.01 MiB/s, done. 
> Resolving deltas: 100% (12988/12988), completed with 3257 local objects. 
> From https://github.com/rg3/youtube-dl 
>629dc1892..b876a9cd7  gh-pages -> origin/gh-pages 
>a4d6cf970..3dc8b61b7  master   -> origin/master 
>  * [new ref] refs/pull/0/head -> origin/pr/0 
>  * [new ref] refs/pull/100/head   -> origin/pr/100 
>  * [new ref] refs/pull/10011/head -> origin/pr/10011 
>  * [new ref] refs/pull/10012/head -> origin/pr/10012 
> ... 
>
> So, instead of updating master, like I thought, or just the one pull 
> request I had previously gotten (NB: those would be the only refs I had 
> from that github), I now have lots and lots of things I don't care about or 
> want. 
>

You explicitly said you want *all* the pull requests (as explained above, 
using the * sign), thus this is expected and correct behavior.


My first question is, if I just delete the files from 
> .git/refs/remotes/origin/pr/ that I don't want, will that result in git 
> cleaning up the unwanted branches? 
>

Yes, you can do that manually, or you can do something like this as well:

(*5*) git for-each-ref --format="%(refname:short)" 
refs/remotes/origin/pr/\* | xargs git branch -rD


My second question is: The only way I could manage to update master was: 
>
> keybounceMBP:youtube-dl michael$ git fetch origin master 
> From https://github.com/rg3/youtube-dl 
>  * branchmaster -> FETCH_HEAD 
> keybounceMBP:youtube-dl michael$ git checkout master 
> Switched to branch 'master' 
> Your branch is behind 'origin/master' by 12 commits, and can be 
> fast-forwarded. 
>   (use "git pull" to update your local branch) 
> keybounceMBP:youtube-dl michael$ git pull 
> Updating a4d6cf970..3dc8b61b7 
> Fast-forward 
>  .github/ISSUE_TEMPLATE.md |   6 ++--- 
>
> ... 
>
> So, what is the proper/best usage of fetch/pull? At the moment, I'm 
> interested in these branches: 
> origin master 
> origin refs/pull/12121 
> gkoelln Dish 
>

For what you want, those commands you`ve shown above are correct.


And, while I did explicitly ask for pull request 12121, it did not show up 
> in my remotes -- 
> [branch "master"] 
> remote = origin 
> merge = refs/heads/master 
> [branch "Dish"] 
> remote = gkoelln 
> merge = refs/heads/Dish 
>

Where did you "explicitly ask for pull request 12121" remote tracking 
branch, in order for it to be shown here? I haven`t seen that command in 
your e-mail, so unless you accidentally omitted it, you didn`t actually ask 
for it... yet.


so what do I need to do to 

Re: [git-users] Help with git pull, and restricting what gets pulled

2017-04-26 Thread Michael
Thank you very much.

> Where did you "explicitly ask for pull request 12121" remote tracking branch, 
> in order for it to be shown here? I haven`t seen that command in your e-mail, 
> so unless you accidentally omitted it, you didn`t actually ask for it... yet.

When I said
>   843  git fetch origin refs/pull/12121/head 
I was under the impression that explicitly fetching a specific branch also set 
up a tracking branch for it.

I was not aware that I had to say --track

---
Entertaining minecraft videos
http://YouTube.com/keybounce

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.