This repository is an introduction to git and GitHub. There are no prerequisites required.
If you want to learn more about version control, git and why to use it in software development, I recommend these tutorials from Atlassian:
In general, I found the Atlassian and GitHub tutorials very helpful when it comes to learn git and how to use it. Next to the official Documentation and Guide from git itself.
In this section, you will learn how to create your own GitHub Account and set it up to clone a repository to your PC. But before we start, you should read this introduction to git and GitHub (until GitHub and the command line), to get an understanding about why you should use it and what you can gain from it.
- Create a free GitHub account - Join GitHub
- Generate SSH keys and connect them with your GitHub account - How to add SSH keys to your GitHub Account
Additional tutorials that maybe of help here: - Clone this repository to your PC - How to clone a repository from GitHub
Bravo, now you can follow this guide on your own computer. Therefor, open the repository in an IDE of your choosing, like IntelliJ or VS Code.
in this section, you will learn the basic principles of git and how to use it on your local PC. We will do that with the help of an example repository
-
Create your own repository - Init your own repository.
You can skip the explanation about Bare repositories, later GitHub will do that for us. The name and purpose of the example repository (project) is up to you. For example, mine was about a cat feeding schedule. -
Add a README.md file to your repository - What is a README.md and how to write a good one
This is a very lengthy explanation of README, for us only the beginning until Writing a good README... is relevant. Also, you don't have to include all sections the tutorial is talking about. For now, it is fine if you only include a Title and a short Introduction/Text.- Use this Markdown Cheat Sheet if you like.
- For more information about Markdown, have a look at Getting Started with Markdown
-
Save the README.md to the repository
For that, usegit commit
andgit add
- Explanation of basic git commands & Example of contributing to a repository
Here we tap in to the power and complexity of git. More detailed explanations about this process can be found here:- By GitHub: git add, git commit
- By Atlassian: git add, git commit
-
Publish your repository on GitHub - Create a new repository on GitHub
- Create the public repository without any files
- Visit your GitHub repository after creation. GitHub will give you examples on how to populate it. Go with the push an existing repository example.
- Don't worry about the LICENSE and .gitignore file, we will add them later.
- But if you can't wait, I usually use the MIT license - Licensing a repository
Well done, your README is now out there on the internet, if you have a peer, checkout his Repository ;)
The warning first:
Never add, commit or push sensitive information in your repository!!!
Sensitive information can be Passwords, SSH keys, API keys, credit card numbers, PINs and more.
Because of the nature of git, it is hard to delete something once it is pushed. If it happened any way, don't worry, there are plenty of guides to help you in this situation, for example this one - [Remove sensitive data from a repository].
Now the tips:
- If you ever found your self lost in git and don`t know what is going on, use
git status
. It will tell you what is going on and sometimes even provides tips what to do next. - What does 'git status' do? - If the CLI (Command Line Interface) isn't your home, you can use a GUI (Graphical User Interface) to manage your repository. Modern IDEs (integrated development environment) mostly have a GUI for git included. Or you can use tools like Fork or GitKraken.
Now that we up to speed with git and GitHub, you can, checkout the BOGY-express repository and start writing a backend Server with JavaScript.
If you still have time, you can follow the tutorials in this section to learn more about git.
- Create a branch - git branch
- Checkout another branch - git checkout
- Merge your branch back to
main
- git merge
- See if there are any updates from other contributors - git fetch/pull
- Upload your changes to GitHub (the remote repository) - git push