Git 101 (very very basics)
Summary
git will allow us to connect to a repository, which is a virtual location where we will store code. You can think of it as a Google Drive with many many more features for developers.
Git is included by default with the Linux WSL.
Requirements
git is included in the Ubuntu WSL that we are using. However, we will need to install the GitHub Cli for this session. Follow the installation instructions in this guide.
Create a repository in Github website
It's pretty intuitive but instructions are also available here.
Basic operations (using simple words)
- clone: Creates a copy of the repository in your computer.
gh repo clone owner_github_id/repo_name
You can also use git command but you need to setup a token in your computer:
git clone repo_url
- pull: Downloads the latest changes into your local computer
git pull
- status: View the actual status of the files (which ones were modified or added)
git status
- commit: Get your changes ready and attaches a message describing what has been done.
git commit -am "A message"
- add: Records an instruction to add all the new files created so they are included when you send your changes to the remote repository.
git add .
- push: Send the changes to the remote repository.
git push
- fork: Forking a repo creates a copy of a repository and allows you to experiment with changes without affecting the real project.
Fork
- Pull request (from a fork): It allows you to propose changes you've to a fork, into the original repo.
Pull request from a fork
- Issues: You can create a issue about a bug or new feature that you think should be included so owner's (and the community) can take care of it.
Issues