Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Git and GitHub

Git and GitHub

Getting started with Git and GitHub is probably one thing that doesn't come that easy to budding developers. Hope this presentation helps you out.

Nakshatra Saxena

April 30, 2021
Tweet

Other Decks in Programming

Transcript

  1. What are Git and GitHub? 🤔 Git is a version

    control tool used by developers around the 🌍 . It lets you manage and keep track of your source code history. GitHub is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere. 󰠁
  2. Installation 📥 1. Create your ID on GitHub - https://github.com/

    2. Download and Install Git - https://git-scm.com/downloads
  3. Configuring Git 📍 Run these commands on your terminal /

    shell 1. $ git config --global user.name "John Doe" 2. $ git config --global user.email "[email protected]" For more info visit - https://docs.github.com/en/github/getting-started-with-github/set-up-git
  4. Do we have to commit everything? 🔐 Quite often you’ll

    find files / folders you don’t want people to look into. These can be some passwords, API Keys and stuff like that. You don’t have to commit these files to your Git repository. Just add a .gitignore file in your working directory and mention the files that you don’t want to commit inside it. Git will automatically ignore all the files you write inside the .gitignore
  5. Connecting to Remote 📡 To connect your current local repository

    to your GitHub Account. 1. Create a new repository by clicking on the ➕ icon in your Account 2. Add a remote origin to your local repository - $ git remote add origin https://github.com/<user>/<repo>.git 3. Push your local repository to remote $ git push -u origin master
  6. 🚩 Working Directory Staging Area Local Repository Remote Repository git

    push 👉 1 2 3 👉 git commit 1 2 3 .git GitHub git add 👉
  7. Branching and Merging 🌳 1 2 3 3 4 4

    5 5 git branch feature2 git checkout feature2 git merge feature2
  8. Cloning and Forking 🍴 You can directly clone any repository

    on GitHub into your local system. But it is good practice to first fork that repository in your account, and then clone it. git clone <URL>
  9. Steps to contribute in Open Source 🔓 1. Choose any

    project you’d like to work on 2. Fork the repository of that project into your own Account 🍴 3. Clone repository in your system - git clone <repoURL> 4. Code 󰠁 5. Create a new branch to work upon - git branch verification-module 6. Add these changes to staging - git add . 7. Commit your code - git commit -m “Add Verification Module” 8. Push code to YOUR remote repository 👉 9. Create a Pull Request 10. Wait for maintainers to merge your code ⌛
  10. Glossary 📔 Directory - A folder Repository - A folder

    where software packages are stored (generally) Commit - A snapshot of the current state of your code Push - When you upload a Local repo to a Remote repo Pull - When you Pull code from somewhere, like a Remote Repo Pull Request - A request to the maintainers of a repo to merge your code