Bureaucrats, confirmed, Administrators
4,558
edits
(adds trace setting) |
(add story of merging remotes) |
||
Line 45: | Line 45: | ||
<source lang="bash"> | <source lang="bash"> | ||
git tag -am '' 'REL-1.0-alpha' | git tag -am '' 'REL-1.0-alpha' | ||
</source> | |||
== [https://stackoverflow.com/questions/12921125/git-merge-branch-of-another-remote Git merge branch of another remote] == | |||
When using git between a local repository and a single 'origin' remote, it's a simple process to work locally and push things back up to origin. But, what if you have a separate remote repository... perhaps on GitHub, or a collaborator who has similar sources but not using your origin (so disconnected, and perhaps not even linked ancestrally like a fork). How do you add that other remote to your project and then pull in the code "they" have on top of yours? Here's an example of how we started with a repo from github and added a repo that we were developing privately. (The reality is that we were developing a repo privately; created a sibling version of the code at github; and then wanted to re-incorporate the changes of the github repo back into our private repo.) | |||
<source lang="bash"> | |||
# start with one 'origin' remote | |||
git clone https://github.com/freephile/qb.git | |||
# add another remote that has similar code | |||
git remote add private greg@eqt:/home/greg/src/ad.git | |||
# check | |||
git remote -v | |||
# rename it for the host it came from | |||
git remote rename private eqt | |||
# pull our 'eqt' remote onto the master branch of the code we got from 'origin' | |||
git pull eqt master | |||
# But there are some unversioned files in the way (git complains) | |||
# So, create a new 'dev' branch and stuff all the new things there (which we can either delete, or resume later) | |||
git checkout -b dev | |||
git add hosts package.json requirements.txt scripts/ | |||
git commit -m 'stashing some files into a dev branch' | |||
git checkout master | |||
# now we can merge again | |||
git pull eqt master | |||
# git complains about some merge conflicts (changes on both sides so it can't just do a fast-forward) | |||
# edit those files to remove the conflict markers and get them the way you want them | |||
git add install* launch.yml | |||
# finish your merge by committing the result | |||
git commit -m 'merged additional plays from eqt' | |||
# and push upstream to 'origin' | |||
git push | |||
# and push to other remote 'eqt' | |||
git push eqt | |||
</source> | </source> | ||