Pinterest Stumbleupon Whatsapp
Ads by Google

how to view open source codeIf you’re looking at developing software, going the open source route is one of the best ways to do it. Not only can people view your open source code and submit their own fixes, but you are also encouraged to look at other people’s code to use as a framework or inspiration.

While going open source might be a good choice, you’ll also need to invest in the right community. GitHub is one of the best places to do this, not only because of the sheer amount of users who visit the site, but also because of the features that GitHub offers. If you find an open source app on GitHub, I’ll show you a few things you can do with it, including viewing, editing, and forking the code.

Create an Account

Before you get started with using GitHub, it’s best to create an account with them. Creating an account is free and will allow you to take advantage of numerous features such as forking. GitHub also has different membership levels besides the free one, but a free account should be more than enough for personal use.

Checking Out a Project

how to view open source code
Once you have an account you can dive straight into an open source application found on GitHub. Here you can see the application’s project page, including folders and files pertaining to the application, a network graph, a list of pull requests, open issues, a wiki, and other graphs. Obviously, if you want to see the code within the files, you should click on them and you’ll be presented with the full source code. As far as interpreting the code goes, you’ll need to have some background in the programming language that the application is written in, whether it be Java, C++, Python, or something else. For those wondering, the screenshot shows Caleb Evan’s jcanvas Quickly & Easily Manipulate HTML5's Canvas Element With jCanvas Quickly & Easily Manipulate HTML5's Canvas Element With jCanvas The web as we know it is evolving faster than ever before. As of late, HTML5 is coming into the scene, providing the capability of developing highly interactive web apps without the need for the... Read More project.

Forking a Project

view open source
Editing the code requires some additional steps. If you wish to copy the code without officially forking it on GitHub, you’ll need to download the project’s files and then edit them locally on your computer. However, if you’re truly looking at using the currently available source and creating your own project with it and going in your own direction, you’ll want to fork it. Forking can be accomplished with an account, and by clicking on “Fork” on the project’s page as shown in the screenshot. The next few instructions are for Linux users who should install the Git package for their respective distribution.

view open source
If you wish to retrieve the repository’s files to your computer, you’ll need to run the command git clone https://github.com/username/project_name.git, replacing username with your GitHub username and project_name with the name of the application project that you just forked. Run this command within a folder that should contain all of your GitHub projects, as each git clone command will create a new folder within the one you’re currently residing. This is another way of downloading a project’s file as it doesn’t require login credentials. Now you can change the files as you please using any text editor or IDE. For Linux users, I’d recommend Eclipse or Geany as they’re great programming editors — Eclipse being more full-featured and Geany being leaner. Windows users can also use the native GitHub client Native GitHub Client Application Comes to Windows, Is Ready For Windows 8 [Updates] Native GitHub Client Application Comes to Windows, Is Ready For Windows 8 [Updates] GitHub, one of the leading open-source code repository websites, has recently released a new native application for Windows, called (unsurprisingly) GitHub for Windows. The new GitHub application is free for all, and allows convenient interaction... Read More .

Ads by Google

Uploading Changes to Your Project

view open source
Once you’re done making changes, you can upload the updated files back to GitHub using the command git push origin master while inside the application’s folder. This pushes the changes back into the “origin” pointer (your forked project) and the master branch (default location of source code).

Keeping Track of Upstream

If you’d like to keep track of the upstream project (the one that you forked to create your own), then you’ll need to add what’s called an additional remote. This is basically just another keyword you can use while you’re inside your application’s folder. To create the new remote, run the command git remote add upstream https://github.com/username/project_name.git, where username should be replaced by the username of the original project, and project_name should be replaced by its project name.

Merging Upstream Changes

If you notice that the upstream project has been updated and you’d like to incorporate the changes, you can run git pull upstream after creating the additional remote, and GitHub will download and merge changes from upstream into your project’s files. If everything works perfectly after running that command, you can immediately run git push origin master to push the updates to your own project.

Pull Requests

how to view open source code
If you’d like to contribute back to the upstream project, it’s best to push any changes to your own fork of the project (or your own branch of the upstream project, but that’s only after the original author makes special arrangements). Once you’ve pushed those changes to your repository, you can go to GitHub and submit a pull request. This notifies the original author of the upstream project that you’d like him/her to review the changes that you’ve made and have them pull your changes into the upstream project. It’s a common courtesy to at least offer some of your own modifications back to the upstream project for them to pull as a thank you for forking their project. Whether they accept your request is up to them.

Conclusion

GitHub is fantastic tool that a large amount of open source developers already use. While GitHub uses the Git utility which anyone can configure on their own servers, GitHub really incorporates the community aspect of development, something that is a requirement in the open source world. This introduction should help you get started with the basics. If you would like to learn more about actual programming, you can check out this article on top sites to brush up on C++ 3 Websites To Get Started With Learning C++ Programming Language 3 Websites To Get Started With Learning C++ Programming Language Learning to program can be difficult for many, even with relatively easy programming languages. While Java is easier to get started with (where we have numerous articles here at MakeUseOf for Java as well as... Read More .

Have you used GitHub? What feature do you like the most that people should know about? Let us know in the comments!

  1. paras2354
    August 31, 2016 at 7:58 am

    I have a software can I edit or check their source code ?

  2. Jayesh
    April 26, 2016 at 7:37 am

    When I download the source code then try to setup it in eclipse. Will it work to execute it local?
    Please let me know.

  3. Bo Jackson
    April 29, 2015 at 8:05 pm

    I wanted to edit the source code of Chrome.

    • Saviel Monzac
      April 11, 2016 at 1:11 pm

      did it work?

  4. Tuesday Peacock
    May 5, 2013 at 2:19 pm

    Great Article!!Added it in my favorite articles list..This is my luck to read this article while I've just signed up GitHub and don't know where to start...
    There is quick guide on that site for beginner,but long and little bore to read.your guide is clear and informative..Thanks..:)

    • Danny Stieben
      May 31, 2013 at 5:26 pm

      You're welcome! I know it's hard to start somewhere, but GitHub makes it relatively (and refreshingly) easy.

  5. romajaga
    May 5, 2013 at 1:41 pm

    Thank you! Itis good to know how view it.

  6. Lee
    May 5, 2013 at 12:51 am

    I've tried looking at the code for some projects, but I never know where to start. Once I get to the list of files, how do I know which one is the start of the program (especially if there's no "main.cpp" or similar file)?

    • Max
      May 5, 2013 at 10:24 pm

      Most projects supply a documentation on the wiki/readme.

Leave a Reply

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