Git pull with more detailed target and orgin

67 views Asked by At

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?

1

There are 1 answers

2
PanGalactic On

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.