r/learnpython • u/mo_10 • Sep 22 '20
What is learning GIT?
I saw in a post that you have to learn git for most programming jobs, what exactly is git? and where can i learn it, i always just assumed its just uploading your stuff to github. not too sure if this is the right place to post this
347
Upvotes
1
u/mooperd Sep 22 '20
Git is a portal of pain and suffering but a very useful one. I think it helps to compare it with Dropbox.
Like Dropbox, Git allows you to synchronise a folder on your computer to a cloud service like Github. You can make a commit, which is a snapshot of all the files in your folder, and then make a push - sending your snapshot to Github.
Git is different from Dropbox because all these actions, committing and pushing are made by you, manually. This is where the pain and suffering comes from. Dropbox does this stuff automagically in the background - uploading and downloading files for you.
Git is a wonderful collaboration tool. You can create a branch which you can think of as a kind of copy of the repository. A git repository always has at least one branch - called the "master" or "main" which we try and keep in a good working state - no work in progress is allowed in the master branch.
So we make our changes, we commit these changes to our branch and then push our branches to Github. If you look at some projects on Github you can see the branches that the developers have made.
At some point you will want to merge your branch into the master branch. Github and other git platforms have mechanisms that allow you to do this safely. These mechanisms are called pull requests.
The easiest way to learn git is with a friend. One nice way to do this is writing some poems or story together, one line at a time. You write your line, commit and push. Then they have to pull your changes and add their changes. If you are playing this game on hard mode then you have to make every change with a pull request.
You can read some more I wrote about git here: https://skill-sprint.com/blog/fire-of-the-gods/