Monday, February 8, 2021

Code collaboration on GitHub without CLI

Code collaboration on GitHub without CLI        

    GitHub is widely used tool for collaborative development & version control. It is an easier way to manage versions and share code with peers. However, it is not that easy to implement from CLI, specially for beginners. 

    Posting projects & creating portfolio part is easy. Collaborating with other developers on GitHub, takes a little learning. As it is not possible to run our code on GitHub, we need to download that code (notebook or .py file) on local computer in order to run it.  

How to collaborate coding on GitHub without using CLI?

    There are some simple steps to upload base code to GitHub & download code from GitHub to local computer via GitHub Desktop. You can work on that downloaded code, run it - test it & upload back to GitHub.

1. Installation & account Setup

👉 First step is to Create a GitHub account (if don't have one), need to download GitHub desktop & set up GitHub desktop per instructions.

2. Create or upload code file in shared directory on GitHub

👉 You can skip next 5 steps if you have a shared directory and a python notebook (.ipynb) in it, already on GitHub to practice on.

👉 Create a directory (like Collab_practice) on GitHub in which shared project is going to be placed.

👉 Add team members who can contribute to the code on GitHub.

👉 Start a python notebook (or preferred programming language & IDE) on your computer.

👉 Add a line of code, run it and save it (First_collab).

👉 Upload notebook (First_collab) from local computer to GitHub, via upload file option on GitHub. 

👉 Open that file & review the code in that notebook (First_collab), on GitHub.

3. Download shared file, update & upload back

👉 Click on shared directory, branch it to keep a copy of master code intact & work on the branch. 

👉 Click on 'Code', select 'Open file with GitHub desktop', provide destination folder for directory to be downloaded.

👉 In GitHub Desktop interface, click 'show in explorer' to see where your files are downloaded from GitHub.

👉 Open that local file downloaded from GitHub, in IDE on local computer.

👉 Add second line of code - modify the way you want, run it, save it and close it, same way as we would do with other local notebooks.

👉 Add two new notebooks (second_collab & third_collab) in downloaded parent directory (collab_practice).

👉 Add code lines to both notebooks, run them, save and close.

👉 Go back to GitHub Desktop interface, see files changed.  It will list one notebook is changed & two notebooks are added. It will also show, what is changed in first notebook, where you can add comment on.

👉 Uncheck checkpoints automatically saved by IDE.

👉 Push to main directory on GitHub, with note of changes done, in this commit.

👉 Open GitHub directory and review the changes, it should have first_collab updated and two new notebooks added into it.

    Now, those changes are ready for peer review and eventually branch will be pushed to the master.

Congratulations, code collaboration is done!

No comments:

Post a Comment