Are you confused with Github? Don't the way to use it? Now you have come  to an ideal place to learn how to use it simply. Do not think of it as a mess! Here I will not explain what is GitHub or advantages of using it. I think you are already aware of it. Let's move on...

There are multiple ways to use Github. Some of them are ;
  1. Using GitHub web site
  2. Using command line or terminal
  3. Using a Git Client
I will explain 2 ways among these...

1. Using a Git Client

There are so many Git Clients available in the internet. Here I will use the client called GitKraken.


How to handle the working files with GitKraken

  • Open GitKraken and click on the icon shown as a folder. Then you will get a new window with 3 main options such as open, clone and init. Change the active tab to the clone option and change the middle tab into GitHub.com. Now we are going to clone a repo from the GitHub account. You will be shown all the repositories created in your Git account, now. A screenshot has been included here according to my account.
  • Select the place where you want to download the repository and select the project. Then click on clone the repo button.
  • Then GitKraken will ask to open your downloaded Git repo. Then select open now option. Then repo will be opened with GitKraken.
  • Now open your project in a text editor or IDE and change the files as you want. Save your changes and go back to GitKraken. Here I have downloaded the repo called JavaBasics and edited a file and saved. I have added a comment as shown below.
  • Go back to GitKraken and check for the changes you have done. This is my view.
  • This is the important part. Check for WIP in the interface. That means Work In Progress. You can see the number of changes as  a number there. The one and only change I have made is shown here. 
  • Click on WIP to see the changed file. Then in the right side panel, the changed files will be shown. When you select the file, the changes are shown highlighted.
  • If you are going to submit now, click on stage all changes. Now the files  are ready to be updated! Click on Commit Message and type your commit message. Finally click on the commit change files button.
  • Next you have to push the files to update them in your Git account also.
  • If the process is completed correctly, you will a message displaying success message with light blue background.


You can see the comment is included in the file now. This  is the way to edit your files and push into Github using GitKraken. That's all...

2. Using Terminal

Upload a local Repository using Command Line

All the steps to do this is included in GitHub web site. Visit this link to see the detailed guide. Since I'm using Linux  Mint I can use my terminal easily to execute this process. Steps are shown below.
  • Create a new repository in your GitHub account. 
  • Open your terminal.
  • Navigate to your current working directory of the  project by cd command.
  • Initialize the local repository as your Git Repo for the project. Use following command.
    git init

  • Then add all files of your project to the Git repo.

    git add .

  • Next you have to commit the files by giving a meaningful message which can be understood by anyone indicating what you had done.

    git commit -m "commit-message"

  • After that copy the path of your newly created repo from your GitHub account.

  • Go back to terminal and add the URL of your repo path copied in above step. Use the following command.

    git remote add origin copied_URL

  • Finally push the files with changes you have done, to GitHub.
          git push origin master

Important :
  • When you are creating the repository in GitHub, it should not have the same name having for your local folder. You can use any name.
  • Give a meaningful message as the commit message.
  • When you do adding remote step, you have to use the link shown as below. It will appear when you navigate to the repository you newly created in GiHub.

Clone a Repository using Terminal

You can clone (simply means download) a repository to your local machine from GitHub. Here I will use terminal for it.

  • First navigate to the folder from terminal, where you want download the repo.
  • Then type this command in following format.

   git clone url_of_your_repo local_folder_name

       local folder name means the folder name that you are going to give to the downloaded folder.

       Ex: git clone https://github.com/SalithaUCSC/PHP_Includes.git php

PHP_Includes is my GitHub repo and php is the name given by me to the downloaded folder.

NOTE :
If you want you can download this easily from Github web site easily. But I try to give you some additional tips.


If you are messed up with terminal, get used to use GitKraken Git Client for GitHub activities.
Enjoy with GitKraken!




0 Comments