Skip to content

Instantly share code, notes, and snippets.

@jasoet
Created January 7, 2014 04:44
Show Gist options
  • Select an option

  • Save jasoet/8294733 to your computer and use it in GitHub Desktop.

Select an option

Save jasoet/8294733 to your computer and use it in GitHub Desktop.
Fork Rules

FORKIN' A RAP OH!

FORK A REPO

Go to bitbucket (or github) press fork button, yeah!

e.g. https://bitbucket.org/rockybars/delicious

CLONE MY REPO (FORK)

Clone my own fork of an upstream repo

e.g. I clone my fork of rockybars/delicious i.e. diorahman/delicious

$ git clone git@bitbucket.org:diorahman/delicious.git

SYNC MY REPO

After forking and cloning (since my network sometimes really sloooowww), perhaps, there are changes on the upstream repo. Hence, I'll sync up my repo first!

In my local,

$ git add remote upstream git@bitbucket.org:rockybars/delicious.git
$ git remote -v // checking out
$ git fetch upstream
$ git checkout master // well, just for making sure, yes we're already at master branch
$ git merge upstream/master // merging in!

To let my remote repo diorahman/delicious up-to-date, I'll push my local to my own remote. The origin!

$ git push origin master

TIME TO WORK!

I want to add cheese-receipe feature to rockybars/delicious so,

$ git branch -b `private/cheese-recipe`

Then, I work on my secret recipe,

$ git add cheese.txt
$ echo 'dont use kraft' > cheese.txt
$ git commit -a -m "WOW THAT WAS FANTASTIC!"
...
$ git commit -a -m "OUCH!"
...
$ git commit -a -m "ARGH!"
...
$ git commit -a -m "YUMMYYYY READY!"

Ok, it's done

$ git checkout master 

SYNC AGAIN!

$ git fetch upstream
$ git checkout master // well, just for making sure, yes we're already at master branch
$ git merge upstream/master // merging in!

Preparing my proposal

$ git checkout public/cheese-recipe
$ git merge --squash private/cheese-recipe
$ git commit -v

Then I tell the story about my cheese-recipe, save it.

DO TESTING the integration test! If it's already yummy enough, then it's ready. If not, you can always checking out master and THEN create another branch.

OK, IT's READY

Push it out, sending my proposal!

$ git push origin public/cheese-recipe

Go to bitbucket, compare the branches, between diorahman/public/cheese-recipe and rockybars/delicious. If everything is OK, then create pull-request to rockybars. Add some notes and comments if necessary (you can put comments inline!)

That's it!

Go sync your local master again. Then work with another secret recipe!

Good luck!

CATCH 'EM

If you want to reset your master to upstream/master

git reset --hard upstream/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment