RSS
 
 

Tips for using GitHub

25 Feb

GitHub is great for finding code and then forking it, however one issue is that there are a significant number of idiots forking projects and then making insignificant formatting changes, maybe they want to see their name up on the web or even claim that they are part of the project (great for job interviews)

So when forking a project you need to ensure you have the actual base project and not some numpties re-fork of a re-fork.

Here is a classic example taken of a FULL Git patch:

@@ -6,7 +6,7 @@
6# Datatypes (KEYWORD1)
7#######################################
8
9-DHT22 KEYWORD1
9+DHT22 KEYWORD1
10
11 #######################################
12 # Methods and Functions (KEYWORD2)

So: Always ensure you have the original authors code and then fork from that point. You can always use the GITHub options to go through the other patches that have been forked off of the original project and decide which ones to ‘ignore’ or ‘apply’.

Github Client
Github.app for OSX, Supposed to be “The easiest way to shared code with GitHub”.
Personally I use it for:

  • Pulling projects from GitHub.(Double clicking on the GitHub web link “Clone to mac” launches all the actions needed to duplicate the current repository on your OSX system)
  • and making a quick check on commits.
  • However I personally would not recommended it for anything more than this, because it is just a basic push & pull front end, get any more complex and your liable to end up with a very messy repository that only a trip to the OSX Terminal and the git CLI(command line Interpreter) can get you out of.

    E.G
    Even the most experienced Gitonaut has occasion to issue:

    git reset --hard HEAD~1
    git push origin master -f

    Generally when there is a really embarrassing section of code you don’t want to ever see the light of day, unfortunately using the Github.app “Revert commit” or “Rollback to this commit“, itis not possible because absolutely all commits and un-commits are recorded into the Github system.
    This then causes a knock on effect if you require to issue a “pull request” back to the original author of the code, yes you can branch the local repository on your mac and then work on the branch, but it is far too easy to end-up “publishing” the wrong version back to Github.

    So Points for today:

  • Watch out for numpties and ensure you find the root project on Github.
    (you can always apply the various other patches from other forks via the Github website)
  • Watch out when using the Github.app for OSX, it has some serious caveats
  • Be prepared to clean up the mess left by the Github.app, by resorting to the OSX terminal window and the Git CLI
  •  

    Leave a Reply

     
    *