Note: If you've missed the workshop, or would like a recap, click here for a good resource.
This workshop is aimed at equipping beginners with the fundamentals of understanding and using Git, since it’s a tool that you’ll almost definitely have to use as a developer.
This month also happens to present the greatest opportunity for beginners in open source - Hacktoberfest. And here too, Git is a necessity.
- What is Hacktoberfest and why one should contribute towards open source.
- Version control - What and more importantly, Why?
- Some important concepts and terms
- Installing Git
- Setting up a project
- Typical git workflow
- Cloning a repo
- Creating a branch
- Adding files
- Commits
- Creating pull requests
- A few other useful git commands
This project aims to simplify and guide the way beginners make their first contribution. If you are looking to make your first contribution, follow the steps below.
If you don't have git installed on you machine, download it.
Fork this repository by clicking on the fork button on the top right of this page. This creates a copy of this repository on your account.
Now, clone the forked repository to your machine. Go to you GitHub account, open the forked repository, click on the code button and then click the copy to clipboard icon
Open a terminal and run the following command:
git clone <url you just copied>
where <url you just copied>
is the url you copied from the clone dialog box
For example:
git clone https://github.com/your-github-name/Git-Workshop.git
where your-github-name
is your github user name. This downloads a copy of the repository onto your computer
Change to the repository directory on your computer.
cd Git-Workshop
Now create a branch using the git checkout
command
git checkout -b your-branch-name
For example,
git checkout -b add-firstname-lastname
Now, create a .txt file titled <your-full-name>.txt
where <your-full-name>
is your full name and in it write your full name and something about yourself.
If you now go to the project directory and execute the command git status
, you'll see there are changes.
Add those changes to the branch you just created using the git add
command
git add your-full-name.txt
Now, commit those changes using the git commit
command
git commit -m "Add <you-full-name> to Git-Workshop"
replacing <your-full-name>
with your full name
Push your changes using the command git push
git push origin <add-your-branch-name>
replacing with the name of the branch you created earlier.
If you go to your repository on GitHub, you'll see a Compare & pull request button. Click on that button.
Now, submit the pull requestCongratulations! 🙌🏼👏🏼👏🏼 you've done it. You just learnt how to use Git.