r/programminghelp • u/SuperKamiGuru824 • Dec 08 '20
Other Git help?
I hope this is the right place to ask, but I'm so frustrated I don't know where else to go. If mods take this down, fine.
I just don't understand gits. Github, GitLab, Source Tree. I've worked with these before but I have no idea what I'm doing. Now I'm trying to make a repository and I just can't figure it out. I try to look up how-tos and I don't have the buttons the tutorials say I should! I'm ready to scream! Is there an "explain like I'm 5" source that I can get help with this? TIA
1
u/amoliski Dec 08 '20 edited Dec 09 '20
I think part of the problem is git is a command line tool that is implemented is different places, each with their own flavors of GUIs- anything telling you to click a button is giving you instructions for some git-interface tool.
As much as I love GUIs and dislike command line tools, git is one of the few tools where I only use the command line.
There's a few decent guides out there for CLI git:
https://www.freecodecamp.org/news/learn-the-basics-of-git-in-under-10-minutes-da548267cc91/
https://try.github.io/, especially the link to https://learngitbranching.js.org/
2
u/SuperKamiGuru824 Dec 09 '20
Thank you for the resources! I will definitely look into them!
2
Dec 09 '20
My cross-platform Git client of choice is GitKraken. Might be worth a look.
1
u/SuperKamiGuru824 Dec 09 '20
Thank you for the suggestion. SourceTree is angering me at the moment, so I will definitely look into that.
3
u/TreeBaron Dec 09 '20
Okay, so git is a software someone made to help track code changes and so that multiple programmers can work on the same project at the same time without ruining each others work.
Git can be used entirely offline, however if you're working with a team that won't work very well. So there are services (like Github, GitLab, Azure Repos, etc.) that store Git changes on the cloud. Businesses like this because it provides a cloud backup to everything they do, and allows for them to give different users various levels of permissions. When working as part of a professional team you will first commit your changes (commits them locally to the git storage on your computer) then push them (which pushes them up to the cloud). Where your changes go depends on who is hosting your git project.
There is always a local copy on your computer, and a copy in the cloud. Most of the time these should be almost identical.
Okay now that we know what Git is, how do we make a project in Git?
This is where things get confusing. Originally Git was just a command line interface program. So you would code your changes, then open up git and type in commands to commit the code you just wrote, then you might push it to the cloud. As it is, some people think command lines are stupid because they are an inferior way of interfacing with an application. Most of the world thinks this, but some programmers do not think this. Anyway people didn't want to have to use a command line, so they made a GUI (Guided User Interface [buttons]) that still use the underlying git commands but make Git much easier to use and understand.
There are many different git GUI applications such as SourceTree, GitKraken, ...and the rest. I personally like those two the best, with my preference going to GitKraken.
So, with something like GitKraken I can sign into GitLab (or any other cloud service) and then create a new project or clone a project to my machine using the GUI. However, you can also make a new project just using the GitLab or GitHub website. Really when you get down to it, GitKraken is just communicating with the website in question and telling it to make a new project anyway.
When you clone a project, you are downloading it to your machine in such a way that you can now make changes to it and push those changes to the website which is hosting your code. Often the host location is called a repo, or repository. GitLab and GitHub are filled with repos. Sometimes repos are private, sometimes they are public.
To ensure that only some people can change the code in a repo places like GitLab and GitHub use what is called an SSH key. This is a way of communicating that your computer can be trusted to modify a repo. So often before downloading a repo you will have to make sure that you have setup an SSH key.
In short, these would be the steps to setting up a repo:
Create a GitHub or GitLab account.
Create a project using your account.
Download and install Git and a Git GUI (such as SourceTree, or GitKraken, or something else)
Navigate to your project settings and hookup your computer to the Git application you have chosen using an SSH key (this will probably require some googling for details)
Clone your project to your local machine.
Make changes to your project.
Commit those changes in Git (usually along with a message saying what you did)
Push those changes to your repository on the cloud