Skip to content

Instantly share code, notes, and snippets.

@kopwei
Created August 8, 2013 10:47
Show Gist options
  • Save kopwei/6183644 to your computer and use it in GitHub Desktop.
Save kopwei/6183644 to your computer and use it in GitHub Desktop.
How to merge github branch and local gerrit branch
1) Edit the local .git/config, add the following code:
[remote "github"]
fetch = +refs/heads/*:refs/remotes/github/*
url = git://github.com/PROJ_NAME
2) Check remote branches
git branch -r github
3) Check the validity
git remote show github
4) Fetch remote branches
git fetch github
5) Merge the branch
git branch LOCAL_BR_NAME #If local br exist
git checkout -b LOCAL_BR_BAME #if local br doesn't exist
git merge github/REMOTE_BR_NAME
6) Push to Gerrit
git push #if the branch is on gerrit already
git push origin BRANCH_NAME #if the branch is not there
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment