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 the Web, it has extended to Android, iOS, and Windows mobile application codebase.
Maintaining a codebase for different client applications for a single project is quite complex. Thanks to Github/Gitlab for serving the best mechanism for code management. One of the tasks while coding is to download the code repository(s) for many purposes.
For 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 projects with minimum customizations.
- The codebase is merged with different branches and to get the specific codebase of the branch, you may need to download it 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 an up-to-date version.
- Continuous build integrations require the download of files and folders of the 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.
- Access your GitHub account from https://github.com/ URL. NOTE: Use the account credentials for successful login.
- Open the repository of the project to be worked upon. (This is remote repo.)
- A list of folders and files available in the repo shall be shown.
- The Code drop-down to view the download option is what you should go for.
- Locate Download ZIP.
- Yo! The folders and files you have chosen are on your local environment now.
How to download Files from Github?
- Find the repo of the project to be worked on. A list of files and folders shall be populated.
- Find the file you want to download.
- Choose the branch (of the repo). The one to be chosen to download the file.
- Press the hyperlink of the filename. This shall open the details.
- Locate the Download button highlighted with the green border.
- Use that.
- Yo! The file is ready to work from the local environment.
How to download a file using Raw from a Github account
- Find the project repo.
- Open the file contents by pressing the hyperlink of the filename.
- Use Raw as highlighted with a green border.
- The file shall be downloaded and available to use.
- The Edit icon can be chosen as an alternative way. The file contents can be seen.
- You can choose to copy file contents, and paste into the notepad++.
- Save the notepad++ file locally with the same name.
- The file is available in your local environment.
NOTE: While performing copy-paste, you need to be aware of 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.
- Have the git bash installed on a local machine. Reference link: https://gitforwindows.org/
- Follow onscreen instructions to complete the installation of the git bash.
- Open the tool as shown below.
- 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.
- To set up an email address, use the below.
git config --global user.email “[email protected]”
- 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.
- Yo! The repo is available in 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
- The local repo will be saved as amxonline.
List of Top Git Commands
|Allows you to keep the changes, but are not ready to push to the repository. To keep the saved changes, use this command.
|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.
|To view your commit history in chronological order. Help you to keep track of your changes.
|To remove/delete repo/file. Once you delete the folder, it is necessary to run a recursive command. This
|Your changes will be pushed/committed to the remote repository
|To connect to the remote repository
|To 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.
|To switch to another branch from an active branch.
|To check the current branch of your active local repo. Add or remove branch also can be done using the “-a” and “-d” 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.