DEV Community

Cover image for 3 Ways to Backup Your Code (Even If You Don’t Know Git)
Rizèl Scarlett for GitHub

Posted on

3 Ways to Backup Your Code (Even If You Don’t Know Git)

Today, over 73 million software engineers around the globe use GitHub. While GitHub provides many benefits, including project management, open source collaboration, and automation, early career developers often sign up to host their code and visualize the changes they make over time. Personally, I choose to upload my code to GitHub because:

  • It reduces the risk of losing my code. If I only stored my code on a local computer and that computer stopped working, I’d lose my work forever. My code is always accessible to me with GitHub regardless of what computer I’m using.
  • It helps me land jobs. GitHub serves as my portfolio for hiring managers and talent sources to gauge my technical expertise better. After graduating from my coding boot camp, GitHub was especially conducive to my job search because I lacked professional software engineering experience.
  • It helps me collaborate on projects. Back in the day, before Git and version control (a.k.a. the process of saving different files or ‘versions’ throughout the various stages of a project) existed, people shared their code via email, floppy disk, and other tedious mediums. Today, with tools like GitHub, you can share your code and visually track changes made by each collaborator. I can also communicate with collaborators through comments and GitHub Discussions.

A common way to interface with GitHub is through Git and the terminal. Because Git and the terminal have such a steep learning curve, some developers, especially early career developers, avoid using GitHub. But what if I told you, you could use GitHub to store your programming projects without the command line?

The Difference Between Git and GitHub

Before I describe the various techniques for leveraging GitHub without Git, I want to clarify the difference between the two tools.

Git

In layman’s terms, Git records snapshots of your projects as you save the changes you make throughout history. This allows developers to confidently return to a past version of a project if they make a mistake or discover a problem. To use it, people install Git on their local computers, and in their terminals, they type commands such as git add, git commit, and git push to save their latest changes.

GitHub

At its core, GitHub is a web-based platform for developers to store code on the cloud. It is also available as a mobile app and desktop app.Through the graphical user interface, developers can use GitHub to work with developers worldwide. Over the years, GitHub expanded its offerings to include project management, automation, deployment, security, and more.

GitHub incorporates Git’s version control features to make collaboration easier.

Backup Your Code Without The Command Line

1. GitHub Desktop

GitHub Desktop is a desktop application with a graphical user interface that allows you to retrieve, edit, and save code to GitHub without touching your terminal. Read the official documentation to learn more about installing, configuring, and using GitHub Desktop.

2. GitHub’s Web User Interface

You can upload, edit, and find files directly from GitHub.com without downloading the files or navigating the terminal.

  • Option 1: You can edit the files directly at GitHub.com after uploading them.
  • Option 2: You can edit your files on your local computer, drag and drop your entire folder, and GitHub will “auto-magically” determine which files were changed and only upload the edited files.

Image of managing source control in web based editor

3. GitHub.dev

You can find GitHub’s free, web-based editor at https://github.dev. The web-based editor introduces a lightweight editing experience that runs entirely in your browser. With the web-based editor, you can navigate files and source code repositories from GitHub, and make and commit code changes. You can open any repository, fork, or pull request in the editor. Read the official documentation editing and saving files via github.dev.

Image description

Even if you don’t know Git or feel intimidated by the terminal, you can still use GitHub to back up your code, track changes, and build your portfolio. Of course, as your skills grow and you land a new role, your employer may prefer that you use Git.

Over the next few weeks, I’ll share tips about Git and GitHub that I’ve learned and continue to learn throughout my career in tech. Give me a follow to avoid missing my upcoming blog posts!! Let’s grow together and become version control pros!

Top comments (22)

Collapse
 
aitor profile image
dragonDScript

I wouldn't use GitHub if you don't use Git properly. I'd rather use Dropbox, Drive, an HDD or even OneDrive.

Collapse
 
0vortex profile image
TED Vortex (Teodor Eugen Duțulescu)

This post is not incompatible with that flow, assuming you use GitHub it's quite likely you will eventually start using the gh cli command. Going back to the terminal, using only GitHub, one can backup all personal, org, or someone else's repos using the following script:

export GH_USER="0-vortex";

gh repo list $GH_USER --limit 99999 |
  while read -r repo _; do 
      if [[ $repo =~ "^($GH_USER/*)" ]]; then 
          gh repo clone $repo
      fi;
      sleep 0.3;
  done
Enter fullscreen mode Exit fullscreen mode

The above code clones the code with all its history, but manipulating the gh line one can fine tune that based on preferences, cloud provider, etc.

Don't forget to change the username!

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

Just a small suggestion: you can rewrite this to have the command directly in the loop.

for repo in $(gh repo list $(whoami); do
   # Loop code here
done
Enter fullscreen mode Exit fullscreen mode

Also using whoami in the assumption that your linux username is the same as your github username :D

Thread Thread
 
0vortex profile image
TED Vortex (Teodor Eugen Duțulescu)

I like the one-line improvement but the username is definitely not a given for a lot of people :D

Thread Thread
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

Yep, that's just a suggestion for cases where it's the same; my username is the same everywhere so for me this would work :D

Collapse
 
blackgirlbytes profile image
Rizèl Scarlett

Thanks for seeing my point of view @0vortex !!! Also wow, I just tried out your script..pretty cool 😎

Thread Thread
 
0vortex profile image
TED Vortex (Teodor Eugen Duțulescu)

awlays welcome! it feels like the gh cli is the natural bridge between the desktop experience and full time terminal usage :D

Collapse
 
aitor profile image
dragonDScript

Wow! That script is great. I will start using it in GCP or my machine, probably. Thanks dude!

Thread Thread
 
0vortex profile image
TED Vortex (Teodor Eugen Duțulescu)

no worries, glad it helps you!

Collapse
 
blackgirlbytes profile image
Rizèl Scarlett • Edited

Thanks for your feedback and your perspective.
This blog post is based on my perspective and advice as someone who works at GitHub and teaches a group of people web development skills twice a year. Before we dive into Git and the terminal, I found that it's helpful to introduce them to GitHub via a GUI because they get to understand the difference concepts such as (push, pull, commit).
Then, when they learn Git they have more context around the workflow and commands.

Collapse
 
aitor profile image
dragonDScript

Oh! That's an interesting point of view. Yes, I agree.

Collapse
 
gmkng profile image
gmkng

How are you doing it ??

Collapse
 
mccurcio profile image
Matt Curcio

I use Dropbox box all the time. I keep most of my work there.

Even though I have a GitHub act. I feel like if my computer goes down (and they really shouldn't) I will have a record for backing up all my little piddly tasks. haha

Collapse
 
blackgirlbytes profile image
Rizèl Scarlett • Edited

Whatever works to ease your mind and help you get the job done! 😀 The only hard part about saving in Dropbox is it doesn’t really allow you to revert commits as easily or see who wrote each line of code besides yourself..but I guess you’re probably doing this for personal projects and you’re copying and pasting each version of your code!

Collapse
 
drdavemckay profile image
Dave McKay

Really useful post, thanks! I'm the software engineer in a project involving scientists. They're the experts when it comes to the algorithms they want to use and the scientific results they're looking for. I develop everything else.
I never leave the terminal, but they are not comfortable in that environment. I'm always looking for better ways we can work together, and before reading this I only knew GitHub desktop.
Thanks!

Collapse
 
blackgirlbytes profile image
Rizèl Scarlett

Awesome! I'm glad this post is useful to you and your project team. Also, it's quite validating to know that there ARE people who are collaborating with code, but don't feel comfortable working in the terminal.

Collapse
 
janet41537537 profile image
Janet

Useful information. Thanks

Collapse
 
blackgirlbytes profile image
Rizèl Scarlett

Glad that you found it useful!

Some comments may only be visible to logged-in visitors. Sign in to view all comments.