Sunday, 29 December 2019

Working with Multiple Git Remotes

Git clone from main remote:
git clone -b dev https://.../PROJECT.git

Git add another remote:
git remote add project2 https://.../PROJECT2.git
git fetch project2
git checkout -b dev-project2 project2/dev

Git merge and copy files:
git checkout branch1
git merge    branch2   #merge branch2 into current branch
git checkout branch2 . #copy branch2 into current dir

Git push to remotes
git push origin HEAD:dev
git push project2 HEAD:dev

Local branches:
  • dev
  • dev-project2
  • dev-project3
  • ...
Main remote branches:
  • dev
  • master
Other remote branches:
  • dev
  • master

No comments:

Post a Comment