Introduction The world, as we know it, is changing and data is at the center of it all. As a beginner at LuxdevHq , I will cover Git and Github , how they connect and especially the process to follow when moving a project from Local Folder to Github using Git. This article will showcase my understanding and application of markdown language and DEV as a first time user. What is Git and Github ? Git is an open-source control system that can handle any project with speed and efficiency while Github is a staging platform used to store, manage, track and collaborate on software codes. Workflow Process This is a short process of how a project moves from Local Folder to Github using Git, with examples of commands. 1. Confirm that Git account is well configured and test SSH connection This done by running; ssh -T git@github.com 2. Confirm the folder in use Run; pwd pwd means Print Working Directory. 3. Move into the Desktop folder Run; cd Desktop cd means Change Directory. Then run; pwd 4. Create the project folder This depends on the data that is being analyzed. Example of data - Kenya Road Network Analysis. To create a folder named Kenya Road Network Analysis . Run the command; mkdir Kenya Road Network Analysis mkdir means Make Directory. Then enter the project folder by running; cd Kenya Roads Newtork Analysis Finally run; pwd 5. Create the structure of the project. This is done by creating different folders under the folder created before, (Kenya Road Network Analysis), to show the different file. These folders can be; data, codes, dashboard etc. For practice, create one folder named data. This is done by running; mkdir data 6. Create a README . The README explains the project. Run; touch README.md In order to see all the folders created; Run ls 7. Add the data. The data can either be copied or moved since it is already in the laptop/desktop. For practice, assuming the data is under the folder Documents and is named kenya_road_network.xlsx_, to copy (cp) the data,
run; cp ~/Documents/kenya_road_network.xlsx data/ to move (mv) the data,
run; mv /Documents/kenya_road_network.xlsx data/ The difference between copying and moving a file is that when a file is copied , a duplicate remains in the original folder. When a file is moved , it is removed from the original folder permanently. If the filename has spaces ie. kenya road network.xlsx, use quotation marks. Example run; cp "/Documents/kenya_road_network.xlsx" data/ This is done when both copying and moving files. 8. Adding and Editing files in README.md Run; echo "# Kenya Roads Network Analysis" > README.md This is one of the methods used to add and edir files and text in README . Another way of adding and editing files and text is by running; nano README.md nano is a simple terminal text editor that uses markdown to edit README . After editing in nano, press Ctrl + O then ENTER to save and confirm the filename then Ctrl + X to exit. Finally, run; cat README.md 9. Initialize the project Run; git init Result - Initialized empty Git repository in... 10. Check Status Run; git status Since this is a new repository, the files may appear as Untracked . Untracked files are file that Git is yet to start tracking but are in the project. 11. Git Main Areas These areas are made up of: Working Directory Staging Area Local Git Repository Github Work Directory to Github Process Moving from one area to another requires a Git command. Being in the work directory, with the last command ( git status ), we will stage a specific file by running: git add README.md This will only stage one file. In order to stage the whole project, run; git add . To confirm the project has been staged, run; git status All file created will be added. Create the first commit by running; git commit -m "Add kenya road network analysis project" This creates a Git checkpoint. In order to view the commit history, run; git log Confirm the branch in use by running; git branch It can either be main or master. The branch in use should be main. If it appears as master, rename by running; git branch -M main From here, open Github in the browser and create new Github repository. Enter the title and a simple description. Example; Title - Kenya Road Network Analysis Description - Analysis of all roads networks in Kenya using Excel. Then choose either Public or Private . Finally, create the repository. After creating the repository, Github shows connection options, which can be either SSH or HTTP . Select the SSH connection and copy. Example: git@github.com :USERNAME/kenya-road-network-analysis.git Open Git and make sure that the project is still inside by running; pwd Then connect Git to Github by running; git remote add origin (github connection) That is; git remote add origin git@github.com:USERNAME/kenya-road-network-analysis.git Check the remote by running; git remote -v This will result to both fetch (Git can retrieve information from the remote repository) and push (Git can send commits to the remote repository). Example: origin git@github.com :USERNAME/kenya-road-network-analysis.git (fetch) origin git@github.com :USERNAME/kenya-road-network-analysis.git (push) Finally, push the project to Github by running; git push -u origin main Return to Github browser to verify the project. Conclusion My experience pushing a project to Github was highly educative, being a first-time user. The process is simple, well-rounded but detailed and can help first-time users navigate Git and Github.

Github Project Workflow: Local Folder - Github
Allan Mbugua

