http://stackoverflow.com/questions/1425892/how-do-you-merge-two-git-repositories
Q: Consider the following scenario: I have developed small experimental project A in its own git repo. It has now matured, and I'd like A to be part of larger project B, which has its own big repository. I'd now like to add A as a subdirectory of B.
How do I merge A into B, without losing history on any side?
A:
git remote add -f Bproject /path/to/B
git merge -s ours --no-commit Bproject/master
git read-tree --prefix=dir-B/ -u Bproject/master
git commit -m "Merge B project as our subdirectory"
git pull -s subtree Bproject master
http://stackoverflow.com/questions/2763006/change-the-current-branch-to-master-in-git
Scenario: I have a repository in git. I made a branch, then did some changes both to the master and to the branch. Then, tens of commits later, I realized the branch is in much better state than the master, so I want the branch to "become" the master and disregard the changes on master.
Answer:
git checkout better_branch
git merge --strategy=ours master # keep the content of this branch, but record a merge
git checkout master
git merge better_branch # fast-forward master up to the merge
If you want your history to be a little clearer, I'd recommend adding some information to the merge commit message to make it clear what you've done. Change the second line to:
git merge --strategy=ours --no-commit master
git commit # add information to the template merge message
To view all remote branches: $ git branch -r
git branch
- list local branches with selected current.
First of all you have to fetch the remote repository:
git fetch [remoteName]
Than you can create the new branch and set it up to track the remote branch you want:
git checkout -b newLocalBranch remoteName/remoteBranch
or
git branch --track newLocalBranch remoteName/remoteBranch
git config --global user.name "Chris"
git config --global user.email "[email protected]"
git config user.name "Chris"
git config user.email "[email protected]"
git config --global alias.workprofile 'config user.email "[email protected]"'
git config --global alias.workprofile '!git config user.name "Chris Kelvin"; git config user.email "[email protected]"'
git workprofile
http://www.codeography.com/2011/08/05/project-specific-git-author.html