How to Download From Github?

Source code management has become complex in today’s development practices. The application architecture has evolved from traditional development methodologies to rapid development practices. We call it Agile methodology to run sprint cycles of development. 

Traditional Web development used to have Web as a front-end and REST or SOAP APIs were consumed by the UI (server and client). Now, the client (user interface) channels are not limited to Web, it has extended to Android, iOS, Windows mobile application codebase. 

Maintaining codebase for different client applications for a single project is quite complex. Thanks to Github/Gitlab for serving the best mechanism for the code management. One of the tasks while coding is to download the code repository(s) for many purposes.

Most organizations having complex system architecture, Git is used as a prerequisite tool for code version control.

  • There are open source public repositories on Github that can be downloaded by the developers and used in their current project with minimum customizations.
  • The codebase is merged with different branches and to get the specific codebase of the branch, you may need to download from that branch.
  • To pull specific files in the code repo, a download is required using Github/Gitlab.
  • The source code is shared by the developer to showcase his skills or to submit as an assignment. This code can be downloaded by the reviewer or the client. 
  • Rapid code development requires continuous push and pull to get uptodate version.
  • Continuous build integrations require download of files and folders of repo.
  • And many more..

How to download folders from Github?

Developers have different needs for downloads from Github. They can get the entire project (including folders and files), a single folder or file(s) to their local environment to start their bit of work.

  1. Access your github account from https://github.com/ URL. NOTE: Use the account credentials for successful login.
Git Hub
  1.  Open the repository of the project to be worked upon. (This is remote repo.)
Git Hub
  1. A list of folders and files available in the repo shall be shown.
Download Zip
  1. The Code drop-down to view the download option is what you should go for.
  2. Locate Download ZIP.
  3. Yo! The folders and files you have chosen are on your local environment now.

How to download File from Github?

  1. Find the repo of the project to be worked on. A list of files and folders shall be populated.
  2. Find the file you want to download.
Code
  1. Choose the branch (of the repo). The one to be chosen to download the file.
  2. Press the hyperlink of filename. This shall open the details.
Git Hub
  1. Locate the Download button highlighted with the green border.
Download
  1. Use that. 
  2. Yo! The file is ready to work from the local environment. 

How to download a file using Raw from Github account

Usually code files are simple text files with small in size. Alternatively, the content can be copied and pasted locally in the local project folder. You can choose to use Raw for downloading the file.

  1. Find the project repo.
  2. Open the file contents by pressing the hyperlink of the filename.
Raw
  1. Use Raw as highlighted with a green border.
  2. The file shall be downloaded and available to use.
  3. The Edit icon can be chosen as an alternative way. The file contents can be seen.
Code
  1. You can choose to copy file contents, paste in the notepad++.
  2. Save the notepad++ file locally with the same name.
  3. The file is available in your local environment.

NOTE: While performing copy-paste, you need to be aware of the committing changes remotely to avoid version conflicts.

How to download Git Bash?

Git bash commands are very useful to fasten the process of code development. Switching between the branches, cloning the repo, fork the branch(es) and so on. All these can be done via simple commands using the command line window.

  1. Have the git bash installed on a local machine. Reference link: https://gitforwindows.org/
  2. Follow onscreen instructions to complete the installation of git bash.
  3. Open the tool as shown below.
Git bash
  1. Please set up credentials to connect to a centralized Github project.
git config --global user.name “Tina S”

NOTE: The user.name = “TIna S” in this example.

  1. To set up an email address, use the below.
git config --global user.email “[email protected]
  1. Cloning is the next step or command that needs to be executed.
git clone https://github.com/tinas/amx-online.git

Tip: The URL is located at the Code pop up. Reference highlighted with the green border below.

Clone
  1. Yo! The repo is available on the local environment with the folders and files. To give the repo a name, you can execute an additional command here.
git clone https://github.com/tinas/amx-online.git amxonline
  1. The local repo will be saved as amxonline.

List of Top Git Commands

git stashAllows you to keep the changes, but not ready to push to the repository. To keep the saved changes, use this command.
git status Shows you the status of the active branch. If any changes are stashed, it will show you. You can take a call based on viewing the status.
git logTo view your commits history in chronological order. Help you to keep track of your changes.
git rmTo remove/delete repo/file. Once you delete the folder, it is necessary to run a recursive command. This 
git pushYou changes will be pushed / committed to remote repository
git remoteTo connect to remote repository
git mergeTo merge branches together. If you are working on a branch and want to get the changes of your colleague who is working on the same file, but with a different branch. This command is used to merge branches with the changes made by both.
git checkoutTo switch to another branch from an active branch.
git branchTo check the current branch of your active local repo. Add or remove branch also can be done using the “-a” and “-d” commands
Git Commands

Git makes developers life easier

Branching mechanism, version control, and collaborating with codes written by a team of developers are some awesome features of Git. Each problem faced while managing the codebase is taken care of and Git provides a solution for it. One can cherry-pick the code from one branch and make the changes to the currently active branch. Each commits tagged with a unique number makes it easier to do so. All of these can be done only if you have access to the repo with developer rights. Github also provides role-based access to restrict using some of the commands. This avoids deleting or not taking unusual actions using the Git commands.