This is a mirror of official site: http://jasper-net.blogspot.com/

Some Notes on Git

| Wednesday, February 13, 2013
This set of notes covers the main things that I think you need to know about working with git. It is not comprehensive and mainly serves as a reminder for myself.

Remotes

In a typical open source workflow using GitHub or BitBucket, you would fork the main repository into your own and then clone that copy to your local computer:

git clone git@github.com:akrabat/joind.in.git

You then need to connect your local repository to the main repository. By convention, the main repository is known as upstream:

git remote add upstream git://github.com/joindin/joind.in.git

To sync your local repository with upstream and update your copy back on BitBucket/GitHub:

git checkout master
git fetch upstream
git merge --ff-only upstream/master
git push origin

Branching

The main branch in the repository is called master. Never ever code directly on master. Always create a branch and code on that and then merge back to master when complete.

(Note that the push command is also used throughout this document to sync your local repository with your remote on BitBucket/GitHub. If don't want to publish, then don't push.)

Create a branch:

git checkout -b my-branch-name
git push origin my-branch-name

Read more: DZone
QR: Inline image 1

Posted via email from Jasper-net

0 comments: