-1

Scenario:

I have 4 repositories, 1 not belong to me

Production 
DevA 
DevB 
DevExternal(Another Dev's repo that I dont have access to except pull)

There are two branches on DevA Repo

Branch1 
Branch2

From time to time, I intended to be on my DevA (use checkout), while I actually on DevB and I start pull from DevExternal. Result is that all the changes I intend to pull from Dev External to DevA now get into DevB. All the mess need to resolve.

I wonder if there is a more specific way to write git pull so that when you are checkedout on a branch but I can somehow say

git pull DevExternal master (to DevA master)

.

I feel the quoted part is really what I need to be able to write so to prevent such mistake again.

Any idea on this one?

ey dee ey em
  • 7,991
  • 14
  • 65
  • 121

1 Answers1

0

When you do git pull with a remote branch name, it will fetch the remote branch and then merge it into your current local branch.

In that case (if I understand correctly what is that you want to do) you do:

git checkout DevB and then

git pull DevExternal

So what's in DevExternal now is merged in your DevB.

PanGalactic
  • 72
  • 1
  • 8
  • i wonder if its possible to still mention your current branch of the repo so when one is not really pull into the right repo, such mistake could be avoided with such double check like command , does it make sense? – ey dee ey em Dec 01 '14 at 00:20
  • I'm not sure i understand what you're asking. But in general you can see your current branch with `git branch` (it lists all the branches and indicates the one you're in at the moment) – PanGalactic Dec 01 '14 at 18:34