After so long, after continuous use of git, I also know the specific method.
Assume that warehouse a is the final use warehouse and b is the release warehouse. The branches are all dev
Now I will reply to myself:
The first step is to add a remote warehouse git remote add origin1 git.a git remote add origin2 git.b
The second step is to ensure that there is nothing changed locally, pull the remote warehouse address, and then rebase. git fetch origin1 git rebase -i origin1/dev
In fact, you can clear the initialization files and add the address of another remote warehouse to the local .git/config, such as: [remote "all"] url = https://github.com/segment/test.git url = https://git.oschina.net/segment/test.git The subsequent operations are the same. Submitting the code will be submitted to the two warehouses simultaneously.
The solution to keep all logs of a branch (assumed to be the master branch) the same:
Add B to the remote list git remote add jae git://xxxxx@xxxx.git
Assume that C has synchronized A and completed the modification. Then you need to submit C to B. At this time, you need to force the submission to avoid the problem of conflict being unable to submit: git push jae master:master --force
After pushing it up, the logs of C and B will be consistent, and you can continue the operation after that
If you want to keep all branches consistent, I suggest you simply create a new project on jae and push C up
I guess, before pulling from any remote repository, first
git stash
Then pull, modify, add, submit, push. Again
git stash pop
Then resolve conflicts if there are any. If there are no conflicts, directly pull the code from another remote warehouse, and then modify, add, submit, and push step by step. It's all based on guessing. Please practice it yourself if you are specific. for reference only.
I think you already know how to add multiple remote repositories, so I won’t go into that.
Straightforward: When C=A, under Cgit push -f 'B远程仓库' '分支'In this way, although B will conflict with A C, it will be forced to overwrite the state of C. So A=B=C. The LOG will be consistent after that. The -f parameter means forced push. just try it
After so long, after continuous use of git, I also know the specific method.
Assume that warehouse a is the final use warehouse and b is the release warehouse. The branches are all dev
Now I will reply to myself:
The first step is to add a remote warehouse
git remote add origin1 git.a
git remote add origin2 git.b
The second step is to ensure that there is nothing changed locally, pull the remote warehouse address, and then rebase.
git fetch origin1
git rebase -i origin1/dev
If there is a conflict, resolve it.
git push -f origin1 dev
git push -f origin2 dev
done.
In fact, you can clear the initialization files and add the address of another remote warehouse to the local .git/config, such as:
[remote "all"]
url = https://github.com/segment/test.git
url = https://git.oschina.net/segment/test.git
The subsequent operations are the same. Submitting the code will be submitted to the two warehouses simultaneously.
I haven’t tried the situation of two git repositories. My guess is this:
1.git remote add $C remote warehouse name $C remote warehouse url
2.fetch to C
3. Local merge
4.push $C remote warehouse name $project name
Reference: http://www.git-scm.com/book/zh/Git-%E5%9F%BA%E7%A1%80-%E8%BF%9C%E7%A8%8B%E4%BB %93%E5%BA%93%E7%9A%84%E4%BD%BF%E7%94%A8
The solution to keep all logs of a branch (assumed to be the master branch) the same:
After pushing it up, the logs of C and B will be consistent, and you can continue the operation after that
If you want to keep all branches consistent, I suggest you simply create a new project on jae and push C up
Hope it helps you
I guess, before pulling from any remote repository, first
Then pull, modify, add, submit, push. Again
Then resolve conflicts if there are any. If there are no conflicts, directly pull the code from another remote warehouse, and then modify, add, submit, and push step by step.
It's all based on guessing. Please practice it yourself if you are specific. for reference only.
I think you already know how to add multiple remote repositories, so I won’t go into that.
Straightforward: When C=A, under C
git push -f 'B远程仓库' '分支'
In this way, although B will conflict with A C, it will be forced to overwrite the state of C. So A=B=C. The LOG will be consistent after that. The -f parameter means forced push.just try it
Just configure the mirror warehouse
1.git remote add --mirror=push --mirror=fetch repoName url
2.git push repoName master