Fri. Sep 24th, 2021

Matics Today

Technology, Gadgets and Video Games

Github & Its Versioning – Complete Method

3 min read

What is GitHub:

Github is actually a platform for Software Developers, where developers from all over the world collaborate with each other on code and report bugs.

As a coder, one can’t avoid using GitHub or Git-based tools. It can be used to share code or to help other people facing code issues. This topic would deeply explain about connecting your App with GitHub and control its versioning for improving workflow accordingly.

What is Version Control:

Version control is basically a process of managing projects in a more synchronized form. By using this sort of Versioning, you can manage projects remotely. Moreover, you can make branch public/private according to needs.

So, Let’s create a project using the android studio.

Project Creation:

Run Android Studio on Windows/Mac & follow these steps accordingly with the help of infographics.

Github

Click on next & move towards the configuration of the project.

Configure Project

Create a new module or library here.

New module
Android library
Github versioning control

Now, create a Java Class in the library by name “HelperMethod”

Make a string var in this class

Public static String name = "helperMethod";

Afterward, add an account of Github on the Android studio. If it is added already, then proceed towards the following.

Add that account to Android Studio:

Version Control

Now enable GitHub Version control integration from VCS.

VCS
Selection of Git

Select Git Option & Commit it.

Commit message: “New APPLICATION CREATED”

Commit your message means, finalization of changes you have done.

Commit Changes
GitHub User Menu

Now share your project on Github.

Project on Github

Here, you can clearly see a project in your Git panel. Make branch as private, otherwise, it’s gonna visible to all viewers.

Now, copy the link from Github project and paste it to Jitpack.

Create a second new project, for doing Versioning.

Then add following in build Gradle under all projects.

maven { url 'https://jitpack.io' }
Code Commands

Click on the Look Up option, it will give an error of no access token. Because your project is private. So make it public by going to Github > Settings > DangerZone and make your branch Public.

Don’t forget to typing your project name to confirm it as public.

Sign Up to Jitpack,

Click button Look Up, it will give you 3 options.

Click on Get it and add the repositories in your Gradle

Github and Apps
Add a dependency to your project:
dependencies {implementation 'com.github.yourUserName:GithubVersioning:7ceeff640d'}

Now add toast to the main activity and access class of your other project. If it is accessible, this means that you are going in the right direction. When you again commit, it will show that there are 2 commits in Github panel.

Manage Topics

How to release a commit on Github?

We need to release a publish, if you want to display the latest code then you have to release your latest commits. Click on the release tab

Release Commit Github

Then click on the new release,

Add your release version, it’s title and description as well.

Then publish your release,

Release Method

Refresh your browser and check out for the new release. The previous Release which was 0 will be updated with 1 release.

Now change dependency in build. gradle file with 1.0 and sync it. You can also create a badge, which will automatically tell you the number of versions you have.

How to Create a Badge:

Add README.md file

Go to jetpack.io, below portion of add dependency. There will be a line, add that into your read.me file and commit it.

This will be added accordingly. Now you can directly check your versions and all of its detail. You can also add more badges, & ApK description, etc.

In last, make your branch private and check dependency. It will be accessible to your other projects.

Github is Everything:

So, I hope this topic clearly reflects each & every aspect of the Github and its Versioning process. Bundle of thanks to Khurria Zaffar (Software Engineer, Codematics.Inc) for sharing her first hand experience over this unique method. I hope it will technically help a lot to all developer guys.

#HappyCoding

You may also like: Galaxy S11 Design & Concept – A Futuristic Smartphone

Share in your circle

Bitnami