In the world of coding, while information is easily accessible, it's also rather overwhelming. A good place to start is Git, one of the most popular free and open source version control systems. This being helpful when working in any number that is more than one, or just helpful in keeping track for larger projects.
As a beginner in this, let's walk through this together!
Beyond simply knowing how to do, but understanding how Git allows users to "commit" in order to create a smoother and more coherent team experience (not just for coding) regarding data integrity, flexibility, and consistency. That is what the end goal of our little learning journey is.
Beginning with, it is necessary to install Git itself and then try out different methods and UIs (user interfaces) you may prefer. For now, I'm choosing only to do the basics with the GitHub website (not inherently tied together with Git as many may assume but widely used) and simple command line. Here's my Video on it and the transcribed steps with it:
I simply used the Git website to get started:
Download Git Here
You won't need this for committing via the GitHub browser but if you want to make commits via the command line or terminals, then you'll need it!
At first I was confused because git seemed like something way out of my pay grade (of $0), but it's like every other new language. Everyone has to start somewhere so here are so of the most common vocab:
Repository - container or project for Git, shortened to "repo" at times
Local - on your own local, personal device
Remote - the one shared on some server usually with teammates to keep track of files and changes
Commit - mark a time in your code
Pull - pull current code or "download" from source code
Push - push or "upload" code to source code base (others will be able to see what changes you have made)
Fork - making a copy of repo ("fork it over")
Clone - make a separate copy or clone of the source code that is
Branch - branch off of the tree or separate timeline off the source code
Tag - mark a time in your repo
Thankfully Git itself has helpful guides to those simply starting off. You're always a search away from answers (usually).
It is possible to make a local repository but most software developers collaborating do so via a remote repository so we will focus on that. To do that, we will be utilizing GitHub, which is often paired together with Git as it is reliant on it.
a. Start by creating a GitHub account or logging into an already existing one
b. Click "Start a Project"
c. Enter the name you wish to give your repository, toggle any desired features on and off
d. Create repository
Now you should have a pretty empty repository that we are going to start populating with files via your local device next.
On the Command Line:
By inputting this into your command line terminal interface, it should initialize your local repository:
Create a file or add an existing.
git add . to add all files in your project but if you only want to add a specific file then do
git add FILENAME
a. GitHub (requires an account)
GitHub actually offers the ability to manually commit and make a push or pull request on its own site.
b. Command Line
While it may seem a lot, memorizing these few commands can help you in the long run by a lot. These should work whether via a IDE's command line or your device's terminal itself.
git commit -m "message here i.e. new file added"
git remote add origin URL
with the URL part instead being the URL of your GitHub repository.
Usually when a main branch already exists, creating a separating branch or timeline is a good call for possible conflicting changes. However for now, since we were just going through the basics, I simply did;
`branch -M main"
git push -u origin main
I definitely feel like commits via the command line might be more neat in the long run (keeping track with different users) though it has a slightly higher learning curve than using just the GitHub browser. The GitHub browser method of committing is overall easy for daily activities involving Git though.
For committing via the command line, friendly users of git have told me spamming a few of these commands is really helpful if you have anxiety on accidentally rattling the main tree. They're also just neat ways to keep check and log of all updates to the project in comparison to your branch.
Other helpful commands:
git branch - checks what branch you're on
git branch <name> - creates another branch
git log - shows a log of all commits you have made
git status - tells you your remote repository and untracked files compared to the main remote repository's status and changes
Video on This: https://www.youtube.com/watch?v=j-sQuJtnKaU
YouTube Channel: https://www.youtube.com/channel/UCjR8IqMXgs6H69ZQqrsS1Vw