I have created 2 Git repositories (Dev and staging) and branches b1, b2 and b3 in each of the repositories. Now how can I merge say b1 of Dev to b2 to Staging? Is there anything that can be automated so that I will save my time? Or any hookup scripts can be written to do this?
Asked
Active
Viewed 2,936 times
1 Answers
4
You need to add a new remote in the Staging
repository to point to Dev
git remote add dev /path/to/repo.git
Fetch all from the dev remote.
git fetch dev
Make sure you are on B2
of Staging
. Merge Dev/b1 into Staging b2
git checkout B2
git merge dev/b1

Bartlomiej Lewandowski
- 10,771
- 14
- 44
- 75
-
Thanks a lot! that really helped. Going ahead, i believe the same thing can be done from my instance to Amazon hosting server where i have Git installed, i.e., to push the code from my staging to production git of Amazon hosted server. Correct me if i am wrong. Also if you can help me in writing a script where I can write those series of commands you have explained so that it saves my time in writing the same commands again and again. – Chinmay Sep 25 '14 at 08:44
-
If the answer answered your question, mark it as such. First try to do this alone, if you have any questions you can ask another question on so, I will gladly help – Bartlomiej Lewandowski Sep 25 '14 at 09:18
-
This is first time for me, so was not aware, my bad. done it though, thanks again ! – Chinmay Sep 25 '14 at 11:53