Skip to content

Instantly share code, notes, and snippets.

@ljinke
Last active December 22, 2015 08:29
Show Gist options
  • Save ljinke/6445609 to your computer and use it in GitHub Desktop.
Save ljinke/6445609 to your computer and use it in GitHub Desktop.
/*start from local*/
//create repository in github and add .gitignore/readme.md
//init the local folder
git init myfolder
//add created remote repository
git remote add origin https://github.com/liujin/test.git
git fetch origin
//commit local changes
git add .
git commmit -m "init commit"
git push origin
//Start from remote
git clone https://github.com/liujin/test.git
git remote -v
//Start from forked
//fork in github
//clone forked repository\
git clone https://github.com/liujin/forked.git
//add upstream repository
git remote add upstream https://github.com/test.git
git remote rm upstream
git remote rename origin upstream
git checkout mybranch
git fetch upstream/develop
get merge upstream/develop
git pull upstream/develop
//create a new branch from the existing one
git checkout -b newBranch develop
//merge a feature to develop branch
git checkout develop
git merge newBranch
git push origin develop
git push upstream/develop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment