Skip to content

Instantly share code, notes, and snippets.

@tgallice

tgallice/git.md Secret

Last active November 5, 2016 12:41
Show Gist options
  • Save tgallice/a9d74c32aed956eaa6c882977e55483e to your computer and use it in GitHub Desktop.
Save tgallice/a9d74c32aed956eaa6c882977e55483e to your computer and use it in GitHub Desktop.
git

Fork and clone

fork

// Clone your own repo
$ git clone git@github.com:t<yourname>/<repo>.git

// add the original repo (upstream) as remote repo
$ git remote add upstream git@github.com:t<ownername>/<repo>.git

Work in a branch

// create and move to a new branch
$ git checkout -b branch_name

// add change
$ git add <files>
$ git commit -m "commit message"

// push your branch on you own repo
$ git push orign branch_name

Open PR

Open PR on <ownername>/<repo> based on your branch_name

For update your master branch

// be sure to be on your master branch
$ git checkout master

// fetch on the original repo not your own 
$ git fetch upstream

// merge upstream/master branch to your master branch
$ git merge upstream/master 

// push the new master to your own remote repo
$ git push origin master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment