Get git going (with pictures)
TLDR; use vscode, it’s very simple.
Even if you have no use for version control, future you may have, and more importantely, your collegues may have.
Install vscode. This is not a requirement, but it has nice interface so this tutorials advises you to do so.
Set your username and email. This will be displayed as author of your work to other collaborators. Open a terminal (or cmd) and type:
$ git config --global author.username replace_with_your_username $ git config --global author.email replace_with_your_email
For every new project
git clone url_to_your_repo
This will make a local copy of the repository on your machine. You will be able to make changes to and then push these changes (commits) back to remote repository for others to use.
You may have to provide your password, depending on where your repository is hosted and wether or not you have your SSH keys setup correctly.
Pull changes other people may have made
Numbers mean how many commits there are to be pulled (1) and how many there are to be pushed (0).
Make new changes
Can be any file within repository.
Select version control tab and type out what you’ve done (commit message).
Click checkmark (commit). You can select only some files to be committed, by moving them to staging area.
Push (and merge if there are conflicts)
Sync indicator now shows (0) remote commits and (1) local commit.
There may be merge conflicts, because other people have changed the same files as you. In this case, review each of the conflicting files (displayed in source control) and after you’re done, commit the merge. Now you should be able to push/pull again.
More useful one-liners
This is the simplest I can make it, but trust me: there is a lot more you can do:
see history of all commits in a graph
$ git log --oneline --graph --all
see changes of a specific commit (
$ git show bac4b00
start work on a parallel branch, not affected by others:
$ git switch --create my-new-branch