Questions from Netherquark in our Discord chat, about learning Git:
how does git function during collaboration?
i couldnt really understand
collaborating using, say GDrive, with a local copy of a docx synced with GDrive and someone editing it from the internet, the word editor crashes whenever the person on the internet tries to save (i lost 20 pages of a 100 page report that was due the next day that way)
do such things happen with git?
Not really. You’re always working locally. You do choose when to “add” things to Git — the staging area you reference later on — and then “commit” the changes you’ve added.
So for example, you’re writing a text or Markdown document in Notepad. You’re saving frequently so the file is always available on your local disk.
Then you add it, commit it, and push it to a shared repo that isn’t on your machine so others can access it.
If other people have made edits at the same time, you’ll need to merge changes. That’s what is built into Git — many people editing the same files and tools for merging changes when they all share.
the tutorial says i create a new repo on Github
where are the contents of the repo stored?
are they local only?
If you create a repo on GitHub, then the repo is stored on Github’s servers, not local at all.
git clone the repo from Github’s servers to get your own local copy. It will be identical files.
if theyre local only at the beginning before anyone clones them, how are they accessible when my machine isnt running?
The reverse is if you create a new repo locally, on your machine. Until you
git push to a remote repo — like GitHub, GitLab, or something you can run yourself like Gitea — the files are only on your machine.
where are all the files for VCS stored? does every computer which clones the repo have all the copies of git?
Yes, everybody does a
git clone to store the actual files locally.
what exactly is the necessity of the staging area?
You may not want to
git add all of your changes at the same time.
You’re still editing file B, but you’re ready to commit the changes to files A & C. You would
git add fileA.txt fileC.TXT and then
earlier, the author talks about generating ssh keys
but, later, in the animation explaining git pull origin master, he still types a password
so are these unrelated?
does every repo have a password or something?
Repos don’t have passwords at all. Servers where online repos are stored for sharing have access control.
Passwords over HTTPS or SSH keys are used to authenticate to the server, which then lets you push, pull, or run other git commands.
lastly, the tutorial icidasset recommended, was useful, but it made humorous mentions to get a mac or use linux
i am willing to dual boot linux, ive even done it before, but is it actually necessary to develop?
i dont want to install it unnecessarily and end up wasting storage
Windows works fine for working with git. I think getting a programmers text editor like VS code will be helpful for you. It has some helpers for Git built in.
link to the tutorial for reference: Learn the Basics of Git in Under 10 Minutes