Git Workflow

Just a draft version – for quick review purpose.

Step 1: Fork your version of the repo online using this guideline.

Step 2: On your terminal, cd into your directory delegated for projects.

$ git clone https://github.com/YOUR_USERNAME/YOUR_FORK.git

Step 3: Clone repository. This can be found on the cloned GitHub repo under the section called HTTPS Clone URL on your right pane.

$ cd YOUR_FORK

$ git remote add upstream https://github.com/OWNER/ORIGINAL_REPOSITORY.git

Step 4: Setup the upstream (central-repository from where you have forked), the original repository’s clone URL needs to be known. Now, you’re synced.

$ git pull upstream

Step 5: Fetch updated changes from your central-repository.

$ git checkout -b new-branch

Step 6: Create a new branch, for a specific feature you’re going to work on. This ensures no conflict during merge process when someone else tries to work on the master branch.

//Make changes to files using your favorite editor – vim, emacs, sublime-text

$ git add –all

$ git commit -m “Appropriate commit message”

$ git push origin new-branch

Step 7: Work on the changes. Add, commit and push the changes to the origin (YOUR_FORK) repository from the new-branch. Note that the new-branch exists only on your local machine and only after the push is successful, the changes are reflected.

Step 8: Now go to https://github.com/YOUR_USERNAME/YOUR_FORK from your browser and then click on “Compare and Review” to create a PR (Pull Request) from your fork to the upstream (central-repository).

If all goes well your PR gets merged else, come back to this post and start from Step 6.

 

References:

Dabbles on web development, loves to talk and write.
Regional Ambassador Lead, Mozilla.
Writes code for Mozilla and FSMK.

Twitter Google+  

Leave a Reply

Your email address will not be published. Required fields are marked *