0

This is how my config file of git looks:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = false
[remote "origin"]
        url = git@github.com:XXXXXXX/training.test.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master
[remote "upstream"]
        url = https://github.com/YYYYYYY/training.test.git
        fetch = +refs/heads/*:refs/remotes/upstream/*

The remote "origin" points to my github account The remote "upstream" points to a different github account from where I forked into mine.

Q1: so everytime I do a git pull, it will pull from my remote (which is "origin"). how will I do a git pull of the remote upstream .

Q2: any changes I commit and push to my repository, the other user "YYYYY" must be notified for a pull request. how would I achieve this?

Kara
  • 6,115
  • 16
  • 50
  • 57
brain storm
  • 30,124
  • 69
  • 225
  • 393

2 Answers2

1
  1. git pull remoterepo remotebranch[:localbranch] (e.g.git pull upstream foo:bar , git pull pustream foo)

    or git checkout --track upstream/remotebranch if your local repo has no such a branch named remotebranch

    you can use git branch -r to show the remote branchs.

  2. you can use github webhook
atupal
  • 16,404
  • 5
  • 31
  • 42
  • This did not work: `git pull upstream/master fatal: 'upstream/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.` – brain storm Jan 08 '14 at 02:41
  • Is means that there is no branch name master in your `upstream` repo. So what branch in upstream you want to pull. e.g. `git pull upstream/foo master` – atupal Jan 08 '14 at 02:43
  • so try to use `git branch -r` to see the remote branchs.:) – atupal Jan 08 '14 at 02:46
  • when I do `git branch -r`, I see the `upstream/master`, but `git pull upstream/master` fails – brain storm Jan 08 '14 at 03:13
  • I am sorry.. Not `git pull upstream/master` but `git pull upstream master` – atupal Jan 08 '14 at 03:14
  • or `git checkout --track upstream/master` if your local repo has no branch named `master` – atupal Jan 08 '14 at 03:21
0
  1. git pull upstream branchname, you can get a complete list of remote branchs by git branch -a
  2. you could config hook in git repository to notify all the members in a project after a push, see here and here

ps. about Q2, you can find a similar question, which provides other solutions

Community
  • 1
  • 1
zealoct
  • 94
  • 3
  • This does not work: I get this error : ` You asked to pull from the remote 'upstream', but did not specify a branch. Because this is not the default configured remote for your current branch, you must specify a branch on the command line`. – brain storm Jan 08 '14 at 02:30
  • @user1988876 then you should use `git pull upstream master`, you can use `git branch -a` to see a complete list of where you can pull from – zealoct Jan 08 '14 at 02:58